MIT License in README: How to Add and Format

Learn how to properly add the MIT license to your README and project. Covers the License section format, LICENSE file creation, badge addition, and package.json license field.

License

Detailed Explanation

Adding the MIT License to Your Project

The MIT License is the most popular open source license, used by React, Angular, Rails, .NET, and thousands of other projects. It allows anyone to use, copy, modify, and distribute your code with minimal restrictions.

The License Section in README

Add a License section near the bottom of your README:

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Creating the LICENSE File

Create a LICENSE file in the repository root:

MIT License

Copyright (c) 2024 Your Name

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Adding a License Badge

Add the badge to the top of your README:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

package.json License Field

Set the license in your package.json:

{
  "license": "MIT"
}

Why MIT?

  • Permissive: Users can do almost anything with the code
  • Compatible: Works with virtually all other licenses
  • Enterprise-friendly: Legal teams approve it quickly
  • Simple: Easy to understand, no complex terms
  • Standard: npm, GitHub, and other tools recognize it natively

MIT vs Other Licenses

License Copyleft Patent Grant Notice Required
MIT No No Yes (copyright)
Apache 2.0 No Yes Yes (NOTICE file)
GPL 3.0 Yes Yes Yes (source code)
BSD 2-Clause No No Yes (copyright)
ISC No No Yes (copyright)

Use Case

Properly licensing an open source project with the MIT license, including adding the correct badge, LICENSE file, README section, and package.json field.

Try It — README Generator

Open full tool