Licenses are the rules of sharing. They're not scary โ they're your superpower! Learn which one to use, what they allow, and why they matter.
Think of it as the rules that come with sharing your creation.
Imagine you bake an amazing cake and want to share the recipe. A license is like a little note you attach that says what others can do with it:
"I'm not sharing the recipe. You can only eat the cake I give you."
"Here's the recipe! Do whatever you want โ just mention I made it."
"Here's the recipe! If you change it, you MUST share your version too!"
"Here's the recipe! Use it freely, and I promise not to sue you."
Without a license, your code is NOT open source โ even if it's on GitHub! By default, copyright law means "all rights reserved." A license is what officially gives people permission to use, modify, and share your work. No license = no one can legally use your code.
These 5 licenses cover 95% of all open-source projects.
In plain English: "Do whatever you want with my code. Just keep my name on it. I'm not responsible if something breaks."
The MIT License is the simplest and most permissive open-source license. It's just 170 words long! It lets anyone use, copy, modify, merge, publish, distribute, and even sell your code โ as long as they include your original copyright notice.
React (Meta), VS Code (Microsoft), jQuery, Ruby on Rails, Node.js, Bootstrap, Electron, and thousands more. It's the #1 most popular license on GitHub!
In plain English: "Use my code freely. But if you change it and share it, you MUST share YOUR code under GPL too. No one can make it closed-source."
Created by Richard Stallman, the GPL is the "copyleft" license. Its key rule: if you use GPL code in your project and distribute it, your entire project must also be GPL. This ensures the code stays free forever โ no company can take it, close it, and sell it.
Linux kernel, WordPress, GIMP, Blender, GCC, Bash, and many core free software projects. If it's part of the GNU project, it's GPL!
โ ๏ธ The "viral" effect: If you use GPL code in your app, your WHOLE app must become GPL. This is why some companies avoid GPL โ they don't want to open their code. But this is exactly what GPL was designed to do: keep software free forever.
In plain English: "Use my code freely, even in commercial products. Plus, I promise not to sue you over any patents in this code. If someone changes it, they must note what they changed."
Apache 2.0 is similar to MIT but adds two important things: patent protection (the author grants you a license to use any patents in the code) and change documentation (modified files must say they were changed).
Android (Google), Kubernetes, TensorFlow, Swift (Apple), Apache HTTP Server, Kafka, Hadoop. Preferred by big companies because of the patent clause!
In plain English: "Do what you want. Keep my copyright notice. Don't use my name to promote your version." Very similar to MIT but from the academic world (Berkeley).
BSD came from the University of California, Berkeley. The 2-clause version is almost identical to MIT. The 3-clause adds a "no endorsement" rule: you can't say "Berkeley approves this" unless they actually do.
FreeBSD, OpenBSD, NetBSD operating systems, Nginx, PostgreSQL (similar), and many university research projects. macOS and PlayStation OS are based on BSD!
In plain English: "Creative Commons is for non-code content: images, music, videos, documents, teaching materials. You choose the rules using simple building blocks!"
CC licenses use a mix-and-match system with 4 building blocks:
The most open CC license is CC0 (public domain โ no restrictions at all!) and CC BY (just give credit). Wikipedia uses CC BY-SA.
Wikipedia (CC BY-SA), Khan Academy, Flickr photos, MIT OpenCourseWare, many YouTube creators, and this Alin Li course! CC is the standard for open educational resources.
See all licenses at a glance!
| Feature | MIT | GPL v3 | Apache 2.0 | BSD |
|---|---|---|---|---|
| Commercial use | โ Yes | โ Yes | โ Yes | โ Yes |
| Modify & distribute | โ Yes | โ Yes | โ Yes | โ Yes |
| Use in closed-source | โ Yes | โ No! | โ Yes | โ Yes |
| Must share changes | โ No | โ ๏ธ YES! | โ No | โ No |
| Patent protection | โ No | โ Yes | โ Yes | โ No |
| Keep copyright notice | โ Yes | โ Yes | โ Yes | โ Yes |
| Note changes | โ No | โ Yes | โ Yes | โ No |
| Complexity | Simple | Complex | Medium | Simple |
| Length | ~170 words | ~5,600 words | ~4,200 words | ~200 words |
| Best for... | Maximum freedom | Keeping code free forever | Enterprise + patents | Academic projects |
Answer 3 questions and we'll recommend the perfect license!
It takes literally 2 minutes!
GitHub's tool makes it easy to pick the right license with a comparison.
In the root of your project, create a file named LICENSE or LICENSE.md
Copy the full license text and replace [year] and [author] with your information.
GitHub will automatically detect your license and show a badge on your repo. On GitHub, you can even add a license when creating a new repo โ just select it from the dropdown!
Let's see if you understood the licenses!