Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When searching the web for a solution to a particular problem, I often find a perfect solution posted on someone's blog, or in a public repository (GitHub, Google Code). Most of the time, the code has no copyright information, nor does the author mention any sort of attribution rules.

I'm pretty sure short snippets are fine, but what if I copy a handful of classes verbatim (again, no copyright notices, TOS, attribution requests, etc...)? Am I under any legal obligation to the original author?

share|improve this question
IANAL, so I can't answer on the copyright issues. But in general, never use code from the internet unless you completely understand what it does – CamelBlues Jan 5 '12 at 16:59
Let's assume I always understand what the code does. – eterps Jan 5 '12 at 17:02
I think this is an almost exact duplicate of Can I use the code in a Github project which does not have a license specified? on Stack Overflow. – Mark Booth Jan 5 '12 at 18:23
Sorry, it didn't occur to me to check Stack Overflow for this question. – eterps Jan 5 '12 at 19:28
up vote 13 down vote accepted

Never use code in your application if you are unclear on its licensing, you can't assume the code is in the public domain just because you failed to find its licence (and it seems to me that you didn't try hard enough).

Google Code doesn't even let you post code unless you specify a licence, so there's little chance (if any) you'll find code there without obvious licensing. Github doesn't have a similar requirement, but all code I've seen hosted there does, one way or the other (check their readme files).

If you found the code in a blog and you really tried to find out its licensing and failed, the best course of action would be to contact the author. Allow for a sensible amount of time for them to respond, and if they don't and you must use the code, consult with a lawyer first.

share|improve this answer
The person should himself hide the code by paying the fees. Whey show something to other when you don't want them to copy it? – Fahad Uddin Jun 19 '13 at 22:42
@Ak1to You cannot assume that a piece of code is free to copy and redistribute just because it's available. That will get you into legal trouble eventually. Always check the license and do your best to comply with it. – Yannis Jun 19 '13 at 23:32

First of all, legal questions should be directed to lawyers, not programmers. Second, whether there is a license included with the code or not, the original author retains copyright of their work. This of course depends on where you live in the world, but I would say this is likely the case. Third, if the license allows (i.e. explicitly specifies) commercial use of the code, you should be fine to use it wherever you want.

Again, consult a lawyer if you are concerned or take your chances!

share|improve this answer

The thing is, if person A writes a piece of code, and publishes it with a big "all rights reserved notice", and person B copies it to his blog and strips away the notice, and then you find it in person B's blog and you go "oh, what do you know, a nice piece of non-copyrighted free code!" and go ahead and use it, you would still be liable. (In theory, if you are ever discovered.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.