Can the MIT License Be Used for Closed-Source Code? A Complete Analysis

The MIT License works perfectly for closed-source code — it governs authorization, not publication.
Many developers mistakenly believe code must be public for the MIT License to apply. This article clarifies that the MIT License is a copyright authorization tool that works regardless of whether code is open or closed source. It covers practical considerations for using MIT-licensed code in proprietary applications, copyright ownership issues, disclaimer limitations, and when a formal contract might be more appropriate than a license.
A Real Question from a Developer
On the open-source community Reddit, a developer posed a seemingly simple yet highly representative question: he was writing code for someone else's closed-source proprietary application. To absolve himself of any future liability for the code (i.e., delivering it "As Is"), he wanted to deliver the code under the MIT License.
His core confusion was:
"Can I use the MIT License even if I have no intention of open-sourcing this code? In other words, does the code have to be publicly released for the MIT License to take effect?"
This question touches on a common misconception many developers have about open-source licenses — whether a license equals "making code public." The answer is very clear: No, the MIT License does not require the code to be public.
What Exactly Is the MIT License
A Minimalist Authorization Agreement
The MIT License is one of the most popular and permissive open-source licenses today. Its full text is extremely short, essentially doing only two things:
- Granting rights: Allowing others to freely use, copy, modify, merge, publish, distribute, sublicense, and sell copies of the software.
- Disclaiming liability: The software is provided "AS IS," and the author bears no express or implied warranty liability, nor is responsible for any damages arising from the use of the software.
The only obligation under the MIT License is: the original copyright notice and license notice must be retained in all copies or substantial portions of the software.
History and Ecosystem Status of the MIT License
The MIT License was first created in the 1980s at the Massachusetts Institute of Technology, originally used for the release of the X Window System. Its design philosophy is to minimize restrictions on software use while retaining only the most basic copyright attribution requirements. According to GitHub statistics, the MIT License has consistently held the top position in open-source project license usage, adopted by more than a quarter of all open-source projects. Well-known projects like React, Node.js, jQuery, and Ruby on Rails all use the MIT License. Its popularity stems precisely from its simplicity — the full text is under 200 English words, anyone can quickly understand its terms, and it imposes virtually no restrictions on commercial use.
License ≠ Public Release
Many people equate "MIT License" with "a public repository on GitHub" — this is a misconception. A license is fundamentally an authorization contract between the copyright holder and the recipient. It specifies "how I allow you to use my code," not "this code must be visible to everyone."
Therefore, you can absolutely deliver code under the MIT License to one specific client without disclosing it to any third party. That code can sit forever in the client's private repository, and the MIT License remains fully valid.
Practical Considerations for Using MIT Code in Closed-Source Applications
Using MIT Code in Closed-Source Applications Is Entirely Viable
Addressing the original poster's specific situation: he's writing code for a closed-source proprietary application and wants to deliver it under the MIT License. This is a completely legal and common practice.
- The MIT License is a permissive license that explicitly allows integration into closed-source, proprietary software. This is precisely what distinguishes it from "copyleft" licenses like the GPL.
- The GPL requires derivative works to also be open-sourced, while MIT has no such requirement. Clients can incorporate your MIT code into their closed-source products without needing to disclose their own source code.
- The "liability disclaimer" effect the poster actually wants is exactly the core protection provided by the "AS IS" and "no warranty" portions of the MIT License terms.
The Essential Difference Between Permissive and Copyleft Licenses
Open-source licenses roughly fall into two camps: permissive and copyleft. Permissive licenses (such as MIT, BSD, Apache 2.0) allow recipients to use code in any way, including integrating it into closed-source proprietary software, with the only obligation typically being to retain copyright notices. Copyleft licenses (such as GPL, LGPL, AGPL) require derivative works to be released under the same or compatible open-source license — this is the so-called "viral" nature. Once your project uses GPL code, the entire project may need to be released under the GPL. This mechanism was championed by Richard Stallman in the free software movement to ensure software freedom is not lost along the distribution chain. For commercial companies, choosing MIT-licensed components means no forced open-source obligations are triggered, which is why MIT is extremely popular in enterprise development.
Practical Details to Keep in Mind
While technically viable, there are several points developers should note:
-
Obligation to retain copyright notices: The MIT License requires retaining copyright and license notices. If the client doesn't want your name exposed in their closed-source product, this needs to be communicated in advance. However, for closed-source products, this notice typically only needs to be retained in source code file headers, not in end-user-facing interfaces.
-
Copyright ownership when "writing code for someone else": There's a question more fundamental than the license here — if this is a work for hire or there's a formal development contract, copyright of the code may already belong to the other party. If you don't hold the copyright, you technically don't have the authority to "grant" rights under the MIT License. In such cases, liability allocation should be clarified through a service contract or commissioned development agreement.
In most common law countries (such as the US and UK), the "work for hire" doctrine stipulates that works created by employees during the course of employment, within the scope of their job duties, automatically have their copyright vest in the employer. Sections 101 and 201(b) of the US Copyright Act explicitly establish this rule. However, the situation for freelancers and independent contractors is far more complex — unless a written copyright assignment agreement exists, independent contractors typically retain copyright over their creations. In China, Article 18 of the Copyright Law establishes a similar system for "duty works," but distinguishes between general duty works (copyright belongs to the author, with the employer having priority use rights) and special duty works (copyright belongs to the employer). Therefore, when a developer says they're "writing code for someone else," copyright ownership depends on the specific legal relationship between the parties — employment, commission, or collaboration.
-
Disclaimer is not an invincible shield: The MIT disclaimer is effective in most jurisdictions, but when gross negligence, fraud, or certain consumer protection laws are involved, the effectiveness of the disclaimer may be limited. For mission-critical code, consulting a professional attorney is recommended.
The "AS IS" disclaimer in the MIT License originates from the "exclusion of implied warranties" clause in Anglo-American contract law. In the US, the Uniform Commercial Code (UCC) allows parties to exclude implied warranties of merchantability and fitness for a particular purpose through explicit written statements. However, in the EU and many civil law countries, consumer protection laws typically provide that certain fundamental rights cannot be excluded by contract. For example, Section 276 of the German Civil Code provides that liability for intentional or grossly negligent conduct cannot be waived in advance. The UK's Unfair Contract Terms Act (UCTA) also imposes a "reasonableness test" on exclusion clauses. This means that while the MIT License's disclaimer is effective in most situations, it does not provide the same level of protection in all jurisdictions worldwide, particularly when the code is used in consumer-facing products or systems involving personal safety.
License vs. Contract: Which Is More Appropriate for Your Scenario
License vs. Contract
For one-to-one custom development scenarios like "writing code for a client," using the MIT License is somewhat of a mismatch. The MIT License is fundamentally designed for software distributed to the public.
If your core goal is simply "disclaiming liability and delivering as-is," then a written development/delivery contract is often more appropriate. A contract can clearly stipulate:
- Copyright ownership (transferred to the client, or retained by you);
- Delivery standards and acceptance criteria;
- Scope of disclaimer and liability caps;
- Whether ongoing maintenance is paid.
When Is the MIT License More Appropriate
If you want to retain your own copyright while allowing the client to freely use and modify the code without bearing any legal liability, the MIT License is a lightweight, clear choice. It avoids the negotiation costs of lengthy contracts — a single standard text handles the authorization relationship.
In simple terms:
- Want to completely wash your hands and just disclaim liability: MIT License + a brief explanation is sufficient.
- Involves paid custom work, copyright transfer, or future liability allocation: A formal contract is more prudent.
Apache 2.0: An Enhanced Alternative to MIT
When developers consider using the MIT License, it's worth knowing about another common alternative — Apache License 2.0. Apache 2.0 is also a permissive license, but adds two important provisions beyond MIT: first, an explicit patent grant, where contributors automatically grant users a license to use their related patents, avoiding the "license trap" (where code is open-source but may infringe on a contributor's patents); second, an explicit requirement for change notices in modified files. For projects involving potential patent issues, Apache 2.0 provides more comprehensive legal protection. Most projects under Google and the Apache Foundation adopt this license. If your code involves algorithmic innovation or may touch patent boundaries, Apache 2.0 may be more suitable than MIT as your license choice.
Conclusion
Returning to the original question: code does not need to be public for the MIT License to be valid. A license governs "authorization," not "publication." Developers can confidently deliver code under the MIT License to a closed-source project that never intends to go open-source.
The confusion behind this question reflects a blind spot in many developers' understanding of open-source licenses — open-source licenses are primarily copyright authorization tools, and only secondarily related to the act of "opening up." Understanding this helps us apply them more flexibly and accurately in real projects. For formal collaborations involving money and liability, a professionally reviewed contract is always the safest choice.
Related articles

Musk's Prediction That AI Will Output Binary Directly: Why Source Code Won't Disappear
Musk proposes AI generating binaries directly, bypassing source code entirely. This article analyzes from four dimensions why this prediction is unlikely to materialize and why the intermediate layer will never disappear.

Cursor Browser Worker Parallelization: Practical Strategies for Working Within Rate Limits
Learn how to parallelize Cursor browser Workers from serial to parallel execution using distributed Worker pools, proxy pools, token bucket algorithms, and exponential backoff to compress 2000-3000 page scraping tasks from hours to 15-20 minutes.

A Practical Guide to Preventing Context Loss During Cursor Development
Learn how to prevent context drift in Cursor, Claude Code, and other AI coding agents using AGENTS.md, layered rules, validation checklists, and structured workflows.