Open Source License Generator · Tutorial
How to choose between the MIT and Apache 2.0 licences
6 min readbeginnerUpdated
MIT and Apache 2.0 are both permissive, and most people can use code under either freely. You will see where they differ, decide which suits your project, and set up Apache 2.0 correctly if you choose it.
What you need
Steps
Compare them in the table
Scroll to Compare the licences. Both are permissive and neither requires sharing source. Apache 2.0 adds a patent grant and asks people to mark files they changed.
Think about patents
With Apache 2.0, every contributor grants users a licence to any of their patents the code uses, and anyone who sues over those patents loses that licence. Companies often prefer it for this reason. MIT says nothing about patents.
Generate Apache 2.0
Load the example. The LICENSE text is the full, unchanged Apache 2.0 licence, so your name doesn’t go in it. Instead, use the source-header.txt output at the top of each file.
Add a NOTICE file if needed
If you bundle third-party code that came with its own NOTICE, keep those notices in a NOTICE file next to LICENSE. People who redistribute your work must keep it.
Try it yourself
Opens the Open Source License Generator with this tutorial's sample loaded.
Common mistakes
- Editing the Apache licence text
- Don’t replace the bracketed placeholder near the end of the Apache text. It is an example of how to apply the licence, not a form to fill in.
- Mixing with GPL v2
- Apache 2.0 code can’t be combined with code licensed only under GPL v2. It works with GPL v3. MIT works with both.
Next steps
Go back to the Open Source License Generator, or keep going with one of these: