If I post my own code to Stack Overflow, can I then use that code in a project that uses a license other than CC-BY-SA?
<p>Suppose that I have a block of code that represents my own original work (i.e. I am the copyright holder), and that I would like to post this code on Stack Overflow--either to answer someone else's question or to ask a question regarding the code.</p>
<p>Let's also suppose that I want to use this code in my own project as well--either one released under a non-copyleft license like the MIT license, or even a closed-source, proprietary program.</p>
<p>If I post my code onto Stack Overflow, which uses the CC-BY-SA 4.0 license (a copyleft license), am I then required to release my project under the CC-BY-SA 4.0 license? Or am I free to use the MIT license or any other license of my choosing?</p>

<p>When you license your creative work under one non-exclusive license such as CC-BY-SA, you are in no way prevented from also licensing your works under different non-exclusive licenses such as MIT. The other license doesn't even have to be an open source license – dual-licensing is a common business model.</p>
<p>You are the sole copyright holder of the creative work. No one else can use your works. By offering licenses, you are giving permissions to other people. But you still retain all your rights. You are not required to comply with these licenses yourself – you are the licensor, not the licensee.</p>
<p>Technically, the licensor of CC-BY-SA 4.0 material does give up some rights. For example, you waive the right to collect royalties when recipients exercise the permissions you gave them through this license (cf section 2.b.3). But that doesn't restrict you outside of that license.</p>

<blockquote>
<p>If I post my code onto Stack Overflow, which uses the CC-BY-SA 4.0 license (a copyleft license), am I then required to release my project under the CC-BY-SA 4.0 license?</p>
</blockquote>
<p>You are not required to, you <strong>have</strong> released it under that licence. Anyone who complies with the the terms of the licence can use your code.</p>
<blockquote>
<p>am I free to use the MIT license or any other license of my choosing?</p>
</blockquote>
<p>Of course you are: it’s your code.</p>
<p>However, anyone who uses your code and complies with <em>any</em> licence you released it under is not violating your copyright.</p>

<p>Let's check the <a href="https://stackoverflow.com/legal/terms-of-service">Stack Overflow Terms of Service</a>:</p>
<blockquote>
<p>Subscriber Content</p>
</blockquote>
<blockquote>
<p>You agree that any and all content, [long list of things you can post on Stack Overflow] (collectively, “Content”) that you provide to the public Network (collectively, “Subscriber Content”), is perpetually and irrevocably licensed to Stack Overflow on a worldwide, royalty-free, <strong>non-exclusive</strong> basis [...]</p>
</blockquote>
<p>I emphasized the term <strong>non-exclusive</strong>, because that's the critical word here. A non-exclusive license means that although you give Stack Exchange a license to use your content, you still retain the right to license it to anyone else under whatever conditions <em>you</em> want.</p>
<p>So when you post some code you created on Stackoverflow, you can still publish it elsewhere under a more permissive or less permissive license if you want.</p>

copyright open-source-software creative-commons licensing