I want to understand when do I need to give attribution to code snippets from Stack Overflow.

  1. Do I need to give attribution when I use code snippets in a blog post (by a blog post I mean a tutorial)

  2. So what is the case if I use it in my software?

Does the attribution apply to case 1 or case 2 or the two? If so, how can I give attribution in the two cases?

PS: I have looked into other questions of this type on Meta Stack Exchange, but I haven't found a clear answer.

  • You have to give attribution by username and url to the content in the place you’re using the code. A dedicated section on your site saying you use SO broadly would also be nice. But it’s attributing to the user, with a link to the content, in the place you’re using it, you’re crediting. Not SO the company or the website broadly. – Dan Bron Aug 11 '19 at 14:32
  • So i have to give attribution in the source code by citing the username of the one who asked the question and the one who gave the answer and also link to the question page but how about if my source code is for commercial purpose do i need to make it open source? – Xeny Aug 11 '19 at 14:54
  • If you are talking about using the posted code as part of your code (instead of just displaying it on a webpage): Is copy-pasting code from Stack Overflow an infringement to CC BY-SA 3.0 or is it considered fair use? – unor Aug 11 '19 at 15:20

You must log in to answer this question.

Browse other questions tagged .