Blog
How to Write a GitHub README in Markdown (Template)
A practical GitHub README template in Markdown: badges, headings, code blocks, tables and the sections people look for before they clone your project.
A README is the front page of a repository. Visitors decide within about ten seconds whether the project does what they need, and every one of those seconds is spent on the README that GitHub renders from README.md.
This is the structure that works, the Markdown that GitHub supports specifically, and the mistakes that make a good project look abandoned.
The filename
Name it README.md at the repository root. GitHub renders it automatically below the file list. Variants that also render: README.markdown, README.rst, and README with no extension. Case matters on Linux and macOS CI but GitHub is forgiving; use the conventional all-caps form.
A second special case: a repository named exactly like your GitHub username, with a README.md, becomes your profile README.
A README template that works
Copy this and replace the placeholders:
# Project name
One sentence that says what this is and who it is for.
[](https://github.com/OWNER/REPO/actions/workflows/ci.yml)
[](LICENSE)
## Features
- What it does, in the user's words
- The one thing that makes it different
- What it deliberately does not do
## Install
```bash
npm install project-name
Quick start
import { thing } from 'project-name';
thing();
Documentation
Contributing
Issues and pull requests are welcome. See CONTRIBUTING.md.
License
MIT © Your Name
The three nested fences are not a typo in this article — that is exactly what a fenced block inside a fenced block requires, and it is one of the most common reasons a README's install section renders as plain text. Write the outer fence with four backticks when the content contains three.
## The sections, in the order readers want them
| Section | Why it exists | Common mistake |
| :--- | :--- | :--- |
| Name + one-liner | Answers "what is this?" | A tagline with no information |
| Badges | Signals build, version, license | Ten badges, no explanation |
| Features | Sells the project in bullets | Marketing adjectives instead of capability |
| Install | Gets the user to a working state | Assuming a toolchain is already set up |
| Quick start | Proves it works in one snippet | A snippet that needs three other files |
| Screenshot or demo | Shows the result | A stale screenshot from v0.1 |
| Docs links | Keeps the README short | 400 lines of API reference inline |
| Contributing / License | Legal and social clarity | Missing license entirely |
A README should be long enough to install and run the project, and no longer. Deep material belongs in `docs/`.
## Markdown that GitHub supports beyond the basics
GitHub renders GitHub Flavored Markdown, which adds a few things worth using:
### Task lists
```markdown
- [x] Parse input
- [ ] Handle streaming
- Parse input
- Handle streaming
Collapsible sections
<details>
<summary>Environment variables</summary>
| Variable | Default | Purpose |
| :--- | :--- | :--- |
| `PORT` | `3000` | HTTP port |
</details>
Useful for tables of configuration that would otherwise dominate the page. Keep a blank line after </summary>.
Alerts
GitHub renders blockquote-style callouts:
> [!NOTE]
> Useful information the reader should not miss.
> [!WARNING]
> Something that can destroy data.
The types are NOTE, TIP, IMPORTANT, WARNING and CAUTION. They render on GitHub but not in most other Markdown viewers, so never put essential information only in an alert.
Tables
Standard pipe tables work, including alignment. Remember the delimiter row — without it, the table renders as text. If you need a table quickly, the table generator produces correct syntax from a grid.
Headings, anchors and the table of contents
GitHub generates an anchor for every heading: ## Getting started becomes #getting-started (lowercase, spaces to hyphens, punctuation dropped). Link to one with:
See [Configuration](#configuration).
Because anchors are generated, renaming a heading breaks every inbound link to it — including links from issues and blog posts. Treat heading text as part of the public interface.
A short README rarely needs a table of contents. Past roughly five screens, add one manually:
- [Install](#install)
- [Usage](#usage)
- [Configuration](#configuration)
- [FAQ](#faq)
Images, screenshots and relative paths

- Relative paths resolve against the repository, not the rendered page, so they work in the GitHub UI and in a local clone.
- Prefer PNG for UI screenshots, SVG for diagrams. Both scale cleanly; GIF or short MP4 for interaction.
- Add real alt text. It is read by screen readers and shown when the image fails to load.
- Do not commit 8 MB screenshots. Compress first; GitHub’s page weight matters on mobile.
Special files GitHub renders
| File | Purpose |
|---|---|
LICENSE |
License text; GitHub shows it in the sidebar |
CONTRIBUTING.md |
Linked automatically in new issues and PRs |
CODE_OF_CONDUCT.md |
Community standards |
SECURITY.md |
How to report vulnerabilities privately |
CHANGELOG.md |
Release history |
.github/ISSUE_TEMPLATE/* |
Issue forms |
.github/PULL_REQUEST_TEMPLATE.md |
PR checklist |
Mistakes that make a README look abandoned
- Install instructions that no longer work. The most damaging error, because it is the one a new user hits first. Test them in a clean environment before each release.
- A badge that says “build passing” for a build that never runs. Empty CI is worse than no badge.
- A screenshot of a UI that no longer exists. Either update it or remove it.
- No license. Without one, the default is “all rights reserved”, which stops companies from using the project at all.
- Raw HTML for layout. It renders on GitHub but breaks in npm, in editors and in most other viewers.
- A wall of text with no headings. Headings are the scan pattern; a README with none is unreadable on a phone.
Previewing a README before you push
GitHub renders Markdown differently from a desktop editor in a few places (alerts, <details>, task lists), so preview in something close to GitHub’s renderer. The GitHub README viewer renders a README with GitHub-style output locally, including task lists, tables and code fences, and the Markdown reader is enough for a plain check of headings and links.
Checklist before pushing:
- The first screen answers “what is this, who is it for”.
- Install and quick-start commands are copy-pasteable and current.
- Every relative link resolves.
- The license is present and matches the badge.
- Code fences are balanced — an unclosed fence swallows the rest of the page.
Frequently asked questions
Does the README need a table of contents?
Only if it is long enough that a reader would scroll to find a section. GitHub’s own file navigation already provides an outline button.
Can a README contain HTML?
Yes, GitHub sanitizes and renders a subset. Use it sparingly: <details>, <br>, <sub> and <img> are the useful cases. Layout built from <div>s breaks everywhere else the file is read.
How do I centre a heading or image in a README?
With <p align="center"> or <div align="center"> around the content. It works on GitHub and is ignored elsewhere. Do not centre the entire README.
Is README.md required?
No, but a repository without one looks unfinished and GitHub will prompt visitors to add it.