Published on November 20, 2026
Estimated Read Time: 8 minutes
Open source licenses explained: how MIT, GPL and Apache 2.0 each grant permissions while the author keeps the copyright, and what that means for your own code.
Open source licenses explained in one line: the author keeps the copyright and gives everyone else permission to use, change and share the code under stated conditions. MIT asks almost nothing, Apache 2.0 adds a patent grant, and the GPL requires that derivative work stay open too.
That's the whole trick. "Open source" doesn't mean "no owner." It means the owner wrote a license that says yes to things copyright law would otherwise say no to.
This guide compares the three licenses you'll meet most often, shows what each one lets you do, and explains where registration fits in. If you're picking a license for your own project or checking whether you can ship someone else's code, start here.
Yes. The question does open source code have copyright comes up constantly, and the answer is always the same. Under the Copyright Act of 1976, source code is a literary work, and protection attaches automatically the moment it's written and fixed in a file (17 U.S.C. § 102). No notice, no registration, no fee.
A license is how the owner shares that protected work. Without one, you couldn't legally copy, modify or distribute the code, even if it sits in a public repository. Public isn't the same as free to use.
This is also why open source license copyright ownership stays with the author. When you contribute to an MIT project, you don't hand your code to the world. You grant a license. The author, or whoever employs the author, still holds the rights. If that second part makes you wonder who actually owns code written on a payroll, the work made for hire rules explain how employers end up as the legal author.
Code dedicated to the public domain has no owner asserting rights. Open source code does. That's why the license text matters so much: it's the only thing standing between you and an infringement claim.
If you're weighing mit vs gpl vs apache license terms, think of them as three points on a dial. At one end you have almost no strings. At the other, the license follows your code wherever it goes.
MIT is short, about 170 words. You can use, copy, modify, merge, publish, distribute, sublicense and sell the software. The only condition is that you keep the original copyright notice and the license text in copies or substantial portions.
That's it. You can fold MIT code into a closed-source commercial product and never release your own source. MIT also says the software comes with no warranty, so the author isn't on the hook if it breaks.
Apache 2.0 is longer, but it does the same basic job with extra protections. You keep the notice, state changes you made to files, and include the license. In return you get an express patent grant from every contributor covering patents their code necessarily infringes.
There's a catch built for your benefit as the user: if you sue someone claiming the software infringes your patent, your patent license ends. That clause discourages patent trolling inside a project. Companies that worry about patents often prefer Apache 2.0 over MIT for this reason.
The GPL is the best-known copyleft license. You can use and modify the code freely, but if you distribute a modified version or something that incorporates it, you must release the whole combined work under the GPL and provide the source. The freedoms travel with the code.
Two versions matter most. GPLv2 and GPLv3 differ on patents, and GPLv3 adds anti-lockdown language for hardware. They aren't fully compatible with each other in every combination, so check the exact version before you mix code.
| Question | MIT | Apache 2.0 | GPL |
|---|---|---|---|
| Use in closed-source product? | Yes | Yes | Only if you release the combined work under the GPL |
| Must keep copyright notice? | Yes | Yes | Yes |
| Express patent grant? | No | Yes | Yes in GPLv3 |
| Must share your changes? | No | No | Yes, when you distribute |
| Must state changes made? | No | Yes | Yes |
Copyleft flips copyright's usual logic. Normally, copyright lets an owner block copying. Copyleft uses that same power to require sharing: you can copy and modify, but only if everyone downstream gets the same freedoms.
The trigger is distribution. If you modify GPL code for your own internal use and never hand it to anyone, you generally don't have to publish anything. Ship it to customers, though, and the obligations kick in.
Where does the line fall between "your code" and "GPL code"? That's the hard part. Linking a GPL library into your program usually makes the combined program a derivative work, so it needs the GPL. Calling a separate GPL program over a command line or network is a murkier call. There are weaker copyleft licenses, like the LGPL, built to allow linking without the full obligation. For close calls, ask a copyright attorney before you ship.
Usually, yes. Open source and commercial aren't opposites. Plenty of paid products are built on MIT, Apache and even GPL components. What matters is meeting each license's conditions.
Here's a practical way to sort it:
Keep a list of every dependency and its license. Many teams discover a stray GPL package only during due diligence for a sale or funding round, which is a bad time to find out. If you're building a product, our copyright checklist for developers and startups covers the housekeeping that prevents this.
Choosing is mostly about what you want others to do with your work.
Whatever you choose, put a LICENSE file in the repository root and a copyright line at the top, such as "Copyright (c) Your Name or Company." Skipping this is the most common mistake. A repository with no license file leaves everyone else with no permission at all.
Remember too that you can only license what you own. If a contractor wrote part of your code, you need to confirm you hold the rights first. And if you're curious whether the logic itself is protected rather than the written code, see our piece on whether you can copyright an algorithm.
You don't have to, but you can, and it matters if you ever need to enforce your license. Registration is optional for protection yet required before you can file an infringement lawsuit over a U.S. work. It also unlocks statutory damages and attorney's fees for infringements that start after registration.
Open source authors sometimes assume a permissive license makes registration pointless. It doesn't. If someone strips your license, ignores GPL obligations or removes your copyright notice, you'll want a registration on file to enforce your terms in court.
Registering uses the same process as any software. You'll file through the Copyright Office's eCO system, either a Single Application at $45 or a Standard Application at $65, and deposit identifying portions of the source code. The Copyright Office's software registration guidance is a reasonable place to start. If you'd rather skip wrestling with eCO, Copyright Engine prepares and files the application for you. For the mechanics, see our walkthrough on how to copyright source code.
Pick a single project, yours or your company's, and spend thirty minutes on it. List every dependency and its license. Confirm your own repository has a LICENSE file and a copyright notice. Flag anything under the GPL that you bundle into something you distribute.
Then decide whether the project is valuable enough to register before you publish more of it. A short audit now is far cheaper than untangling a license conflict after customers are using your code. And if anything looks like a real conflict, bring it to a copyright attorney before you ship.