What will the licence of the code be? If this is jurisdiction / country based what is relevant in this case? The place of origin of the poster, the host where the code lives, or the one who tries to view and reuse the unlicensed code?


4 Answers 4


In that case copyright applies. In most countries, certainly in Europe, this is an automatic process: you publish something, and even without you adding the copyright symbol, you get the copyright.

Software is no different than literature. As a developer, you are considered being the author of your work. When you publish, you are the copyright owner. Copyright law allows an author to prohibit others from reproducing, adapting, or distributing copies of the author's work. In spite of the fact that people can read your source code, your code isn't "free, open source software"!

In short: if you don't add any license information, your code is protected, but make sure you add your name and document when you wrote/published it.

Extra comment:

I am not a lawyer, but I have faced a situation where a code contribution was done publicly and anonymously. I did a huge effort to track down the author (and documented my search), but I couldn't find the contributor. The lawyer told me that, in that case, it was safe to assume that the code was in the public domain, as there was nobody to claim ownership (even after me asking the author to make himself public in a comment section). It's always safe to consult a lawyer in cases like this. And document! document! document!

Update based on a comment:

So it doesn't matter on what site it's published?

Yes, it does. When you register on a site, when you publish something on a site, you agree with the terms of agreement of that site.

Some of these terms may not be legal in the country where you reside, in which case the terms are void. For instance: a site can claim that it owns the IP of every picture you upload. In some European countries, companies such as Facebook risk litigation if they do so, because that term is considered illegal.

However, you should take into account that the terms and agreements can be valid, because the internet doesn't have any borders and you can't assume that people in other countries know what the law says in the country you live in.

There was another question that explains what happens if you post code on StackOverflow: Can I copy-paste a snippet from StackOverflow into my GNU-GPL project?

When you post code or an answer on StackOverflow, every one is free to use it, provided that the rules are obeyed. For instance: I wrote a book The Best iText Questions on StackOverflow which bundles questions and answers that were posted on StackOverflow. I can do so, because I allow people to redistribute the content and I give credit to the people who wrote the questions and answers (actually, I am the author of most of the answers).

This is taken from the Terms of Service:

In the event that You post or otherwise use Subscriber Content outside of the Network or Services, with the exception of content entirely created by You, You agree that You will follow the attribution rules of the Creative Commons Attribution Share Alike license as follows:

  1. You will ensure that any such use of Subscriber Content visually displays or otherwise indicates the source of the Subscriber Content as coming from the Stack Exchange Network. This requirement is satisfied with a discreet text blurb, or some other unobtrusive but clear visual indication.
  2. You will ensure that any such Internet use of Subscriber Content includes a hyperlink directly to the original question on the source site on the Network (e.g., https://stackoverflow.com/questions/12345)
  3. You will ensure that any such use of Subscriber Content visually display or otherwise clearly indicate the author names for every question and answer so used.
  4. You will ensure that any such Internet use of Subscriber Content Hyperlink each author name directly back to his or her user profile page on the source site on the Network (e.g., https://stackoverflow.com/users/12345/username), directly to the Stack Exchange domain, in standard HTML (i.e. not through a Tinyurl or other such indirect hyperlink, form of obfuscation or redirection), without any “nofollow” command or any other such means of avoiding detection by search engines, and visible even with JavaScript disabled.

If you look at my book, you'll see that there's a link to the full question on StackOverflow under every question, as well as a link to the profile of the person who posted the question. I didn't provide such a link for the answers in case I am the author of the answer, because I have the choice to do with my own content what I want. However, I can't prevent that a third party takes my answer and copies it (that wouldn't be fair, but it has happened before and there's very little one can do about it).

  • So it doesn't matter on what site it's published? I'd guess, that if no copyright reference is added to the code, the license of the site it was published on applies.
    – Alex
    Commented Jun 24, 2015 at 9:26
  • I'll update my answer. Commented Jun 24, 2015 at 9:31
  • 3
    If you can't find the author, you have an orphan work and could still get sued. Searching for the author and documenting your effort might help once you're in court, but it's not a get-out-of-jail-free card.
    – Kevin
    Commented Sep 22, 2015 at 18:59
  • @Alex, it does matter if the site states that to publish something there it has to be published under <whatever> conditions. If not, you must assume that the author retains all rights (You aren't even allowed to read it. Yes, absolutely inconsistent with publishing, but this is legalese).
    – vonbrand
    Commented Aug 29, 2021 at 17:10
  • 1
    @vonbrand Copyright is about the right to copy a work and perform it publicly. So a copyright license can't forbid someone from "reading" something published. Unless you are talking about public performance, or reading it out loud publicly.
    – Brandin
    Commented Aug 30, 2021 at 15:51

If you share code without any license declaration, the general assumption is you apply normal copyrights. That means copying it, modifying it or anything else might be risky. A court may judge, that the way you shared it implied some usage, but to depend on that is highly risky.

And code without clear license declaration isn't open source.


Your code will be unlicensed and no one would be allowed to use it. However, by posting it on services like GitHub, you are granting them [non-exclusive, permanent, irrevocable, unlimited] rights to publish your content in connection with the service. Unless the terms of the service requires otherwise and you accepted, you will retain copyright over the content and reserve all other rights.

  • 2
    Judging by the GitHub's terms of service, you're also allowing people to fork your code to their own profiles as well (as long as they're not creating derivative works from it of course).
    – r3bl
    Commented Jun 25, 2015 at 3:58
  • 1
    @r3bl Forking without creating derivative works is effectively a form of publishing. Commented Oct 5, 2015 at 10:01
  • @r3bl, forking without creating a derivative (modifying) makes no sense,
    – vonbrand
    Commented Aug 29, 2021 at 17:35

Check e.g. github's terms of service, in particular point 4: "You grant us and our legal successors the right to store, archive, parse, and display Your Content..." and 5: "By setting your repositories to be viewed publicly, you agree to allow others to view and "fork" your repositories (this means that others may make their own copies of Content from your repositories in repositories they control)." There are more details in the cited document, you should read it carefully.

"Official" sites for Python and such give similar detailed conditions for sharing content. They are very careful not to get into a legal quagmire, or lure their users into one. See also the StackExchange and Wikipedia conditions for contrast. A wiki set up by a local user probably doesn't go as far as spelling out conditions, in which case the default applies: You have no rights whatsoever to use the contents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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