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?


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.

  • 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? – fuddin 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!


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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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