All code posted on Stack Overflow is currently licensed under CC-BY-SA. If the code crosses the "threshold of originality", you have to distribute your whole project under a copyleft license. This may be disliked by people who don't like copyleft, and certainly impractical for proprietary software created by large corporations.

But...suppose I do the following:

  1. Create a new open-source library (CodeSnip), licensed under the LGPL.
  2. Copy and paste all code snippets that I want to use from Stack Overflow into CodeSnip.
  3. Have my proprietary/permissive open-source project link to CodeSnip, thereby using all the code in CodeSnip through an API.
  4. Legally distribute CodeSnip to the general public under the LGPL, while keeping your project under your current license.

Would this policy be in compliance with CC-BY-SA and still allow people to use Stack Overflow code without legal complications?

2 Answers 2


No, you can not.

The SA in CC-BY-SA stands for "share-alike". It means that you can only release it under the same license conditions. That means your library would also have to be licensed under CC-BY-SA. Licensing it under LGPL would be a violation of the CC-BY-SA license.

However, if stackoverflow executes their plan to change to the MIT license, you will be able to do this. MIT is a permissive open source license which allows relicensing under other conditions. It allows you to use any code snippets in your proprietary project as long as you keep an attribution. This attribution requirement can not be removed by relicensing, so creating a LGPL library would not remove the attribution clause.

  • 1
    They're postponing the license change, it won't be happening before March if not later, and it will almost certainly keep default attribution. Jan 16, 2016 at 15:05
  • @curiousdannii I missed that. Answer updated.
    – Philipp
    Jan 16, 2016 at 15:07
  • 1
    @TariqAli undefined. That's why CC-BY-SA is not recommended for software. Software-specific details like dynamic linking are not covered by it appropriately.
    – Philipp
    Jan 16, 2016 at 15:25
  • 1
    The last paragraph is misleading. If Stack Overflow goes ahead with their license change, only new contributions will be licensed under the MIT - older contributions will not.
    – Zizouz212
    Jan 16, 2016 at 20:00
  • 1
    @Philipp, the copyright laws are completely silent on "linking" or "dynamic linking". Sure, the FSF would like to make linking create a derivative work, and even try to define "derivative work" to include this. But that is wishful thinking, "derivative work" is what the law (and perhaps relevant case law) say. Sure, it might become a derivative work by the use of the API exposed, but even that is a murky area of law.
    – vonbrand
    Jan 17, 2016 at 1:44

If they are truly snippets, they probably are below the threshold for copyright protection.

Copyright concerns copying, so writing said code again yourself (taking care to just take the idea behind it, not the exact wording) should put you in the clear.

As last resort, you could ask the authors nicely for permission to release their code under LGPL (or MIT, more in line with the "share with everybody freely" underlying theme of SE).

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.