Date: 2025-07-30
Edited: 2025-08-08
I’ve had to explain software licensing to a few people, so I thought I’d make a short rundown of the topic.
I’m not a lawyer and this isn’t legal advice.
If you don’t provide a license for your software, it’s assumed to be under your copyright, and nobody can legally use or modify it.
If you want people to use your code, you have to explicitly tell them where and when they can use it. This is what software licenses do.
Say you write some code, and PuppyKiller Corp. Inc. wants to distribute software that is either a modification of or depends on your software. Are you:
Check out permissive licenses, like the Unlicense, MIT License, and Apache 2.0 licenses. The main difference between these is the Unlicense doesn’t require users of your code to provide any attribution, while the MIT and Apache licenses require users to include a license disclaimer with your code.
The Apache license also includes provisions to prevent patent trolls from contributing patented code and making your life hell. If your project accepts contributions it’s probably the best pick.
Check out weak-copyleft licenses, like the MPL and LGPL. The MPL requires anyone who distributes compiled versions of your code to distribute any changes they’ve made to it, and the LGPL requires that proprietary software using your code allows end users to change your code and relink new versions of it with the proprietary software.
If you’re shipping a library intended to be dynamically linked with other code or it’s otherwise important to you that end users be able to replace your code, go with the LGPL. Otherwise, go with the MPL.
Check out strong-copyleft licenses, like the GPL and AGPL. The GPL requires anyone who uses your code in a project to distribute the source code for their project under the GPL as well, and the AGPL extends this to services running remotely on another machine.
Effectively, if PuppyKiller Corp. Inc. runs modified versions of your code on their servers and sends the result to their users, the GPL wouldn’t require them to let users see the source code for those modifications, but the AGPL would.
Check out the Creative Commons licenses. The CC BY is analogous to the MIT or Apache 2.0 licenses, the CC BY SA is analogous to the GPL, and the CC 0 is similar to the Unlicense. There are also other CC licenses preventing derivative works or commercial usage if that’s your preference, but those licenses do somewhat go against the ethos of free/open-source software so they won’t be covered in detail here.
Check out the webpage of the organization associated with the license for specifics, or just google.
Generally though, you should include a file named LICENSE or COPYING in the top directory of your project that contains the text of your desired license. Also, include an SPDX-License-Identifier in each source file.