Clarification about the stack overflow license


I want to understand what the stack overflow license.

Attribution : do i need to give attribuiton in a special page in my website if i have coded it with my knowledge and some code snippets from stack overflow?

ShareAlike : do i must make my softwares open source?

Or there is something that i don’t get right?

Where’s the link to the licence?

  1. Yes
  2. If that was the original licence, yes (although afaics posting commercially restricted code would be against both the original licence on that code and SO’s licensing 🤷 but I’m no a lawyer and there seem to be some situations where that could work).

Basically, treat the answers as possible examples of how a problem could be solved, write the code yourself. You’re probably fine copying things when it’s just you for non-commercial purposes. If you are producing code for commercial purpose, you have to be very careful, no copy paste. If you’re producing code in an environment where there are lawyers checking stuff (big company for example) then they’d probably take your head off if you were caught doing it. In practise – often doesn’t matter, but if you put it into commercial code, it could and it’s not worth that risk.

1 Like

You can look at the bottom of a stack overflow page it’s written “user contributions licensed under cc by-sa 3.0 with attribution required.”

1 Like

Thanks, Xeny. That helps.

Okay, that second link tells you exactly what to do:

So let me clarify what we mean by attribution. If you republish this content, we require that you:

1. Visually indicate that the content is from Stack Overflow or the Stack Exchange network in some way. It doesn’t have to be obnoxious; a discreet text blurb is fine.
2. Hyperlink directly to the original question on the source site (e.g.,
3. Show the author names for every question and answer
4. Hyperlink each author name directly back to their user profile page on the source site (e.g.,

By “directly”, I mean each hyperlink must point directly to our domain in standard HTML visible even with JavaScript disabled, and not use a tinyurl or any other form of obfuscation or redirection. Furthermore, the links must not be nofollowed.

So, yes, you’re going to have to put those links somewhere on your page(s) so they are VISIBLE.
I suppose the odd line here and there that is common knowledge or common practices could not will be okay (not legal advice), but copying complete code blocks would be bad.

I agree with @DanCouper; write code yourself as much as you can.

If you use code on SO under the CC BY-SA license, you MUST distribute your app under THE SAME license, even if you sell it. Thus, allowing others to share and redistribute your app.

First thank you for responding
But when i read this i wonder what the word republish mean does using code from stack overflow in my application and selling it count as republishing or does is it when i take code snippets from stack overflow and make with them a tutorial on a blog or post it on others forum ???

Um all.of those, as in it has been published somewhere (SO) and then you publish it somewhere else (ie you re publish it)

1 Like


@Xeny, re- simply means, ‘again’ so, ‘republish’ means publish again, right.
You take SO code or parts of it, and repuiblish it in your app, you must allow others to freely redistribute your app under the same license. You CANNOT restrict people from doing that under that license.
When you PUBLISH a post on a blog or forum, you are republishing it. Had you posted a SO code snippet (how are you defining snippet?) or block on here, you would have to attribute it.

Now, the issue from SO’s side is proving that you did copy code from SO content. Considering that there are only so many ways a particular function/algorithm can be coded, and repetition is inevitable, how easy would that be?

I haven’t understand very well can you just repeat the part about the app does this mean that if i put code from stack overflow in my app i must give attribution??? (this is the important part for me)

you can use the code, but you need to make it freely reusable (under the same license), give proper attribution, and you can’t use the code from stack overflow to make money

1 Like

I strongly suggest that you write your own code. Do the FCC challenges, read books, buy a course, but do it yourself. Besides, if you copy someone else’s code, that could be outdated, how do you know it’s safe?

You MUST visibly attribute ANY SO code, AND use the SAME LICENSE for the WHOLE APP. If someone copies changes and uses your code, you cannot stop them while you have the SO-licensed code in your app.

Unless the user provides a specific license that allows completely free use of the code (they can do this, but almost noone does), if you copy it you technically need to provide attribution (so you need to include a comment linking back to the code), and it needs to be published under the same licence, which would seem to preclude being able to use it in closed-source software. It is unlikely you’d be sued, as the code on SO is generally tiny examples, and non-functional, but I am not a lawyer and copying code verbatim from the internet is definitely not a good idea if you are making money from it. If you are copying large chunks of code from SO, the question would be why

If you are copying any code from SO, you have to provide attribution, that is in the licensing terms