Introduction to software licences
You've written some code, put it online and somebody asks what licence it is under.
Licence? What licence?
Before hurriedly writing "free to use" in a README and hoping for the best, let's look at what a software licence actually does.
Copyright comes first
Software source code is generally protected by copyright. Copyright and software licensing are not the same thing.
Copyright is the underlying legal protection. A licence is one way the copyright holder gives other people permission to do particular things with the work.
Putting source code on a public website or repository does not, by itself, mean everybody has unlimited permission to copy, modify and redistribute it.
A licence grants permissions
A software licence says what somebody is allowed to do and what conditions come with that permission.
For example, a licence may allow people to copy your code, modify it, redistribute it or use it commercially, provided they follow particular conditions.
Open source does not just mean visible source
People sometimes use "open source" to mean "I can see the code". In the formal sense, open-source licences provide rights to use, modify and share software and must satisfy the Open Source Definition.
If you are describing a licence as open source, using an established OSI-approved licence avoids a lot of ambiguity.
Permissive licences
MIT, BSD and Apache 2.0 are examples commonly described as permissive. They generally allow broad reuse, including use in proprietary software, while still having conditions that must be followed.
"Permissive" does not mean "there are no rules". Read the actual licence.
Copyleft licences
Copyleft licences use copyright to require certain freedoms or licensing conditions to be preserved in particular circumstances.
The GNU GPL is the best-known example. The LGPL, AGPL and Mozilla Public License take related but different approaches.
Proprietary licences
Not all software is open source. A proprietary licence can give somebody permission to install and use software while placing much tighter restrictions on copying, modification or redistribution.
Commercial and open source are not opposites, either. Open-source software can be sold, and proprietary software can be given away for no charge.
What if I use no licence?
If you publish your own source without granting a licence, other people should not assume that means they can do whatever they like with it.
Conversely, don't take somebody else's unlicensed code and assume "it was on the internet" is permission. It isn't a very impressive licensing strategy.
Dependencies have licences too
If your project includes, modifies or distributes somebody else's code, that code has its own licence terms. You need to understand what those terms require and whether the licences involved are compatible with what you want to do.
Where does the licence go?
Common practice is to include the licence text in a file such as LICENSE or LICENSE.txt, and mention the licence in your README or documentation.
Some licences have additional notice or source-distribution requirements, so follow the instructions for the licence you actually choose.
Before we go any further
These Nathan Tech guides explain the concepts in plain English. They are not legal advice and they do not replace the licence text.
If licensing has serious commercial or legal consequences for your project, get appropriate professional advice.
Right then. Ready for the alphabet soup? Continue with choosing a software licence.
Image Description