How to open a Markdown (.md) file, read it formatted, and turn it into HTML
The short answer. A .md file is plain text, so any text editor opens it, including Notepad and TextEdit. To read it formatted, with headings, bold and tables, open it in a Markdown viewer: paste it into a Markdown preview in your browser, or press Ctrl+Shift+V in VS Code. To convert Markdown to HTML, a converter turns each mark into the matching tag.
Markdown is a way of writing formatting with ordinary characters: # for a heading, ** around bold text, - for a list item. It was designed so that the raw file is still easy to read, which is why README files, documentation, notes apps and chat tools all use it. The catch is that the file only looks formatted in a program that understands those marks.
What the marks mean
| You type | You get |
|---|---|
# Title |
a top-level heading |
## Section |
a second-level heading |
**bold** and *italic* |
bold and italic |
- item or 1. item |
a bulleted or numbered list |
[text](https://example.com) |
a link |
`code` |
inline code |
| three backticks on a line, code, three backticks | a code block |
| a | b | rows, with a |---|---| line under the first |
a table (GitHub-flavoured Markdown) |
- [ ] task |
a checkbox (GitHub-flavoured Markdown) |
The first seven rows are in the CommonMark specification, the standard most tools follow. Tables, task lists and strikethrough are extensions from GitHub-flavoured Markdown (GFM), which almost every modern viewer also supports.
How to open a .md file
On any device, in the browser:
- Open the file in any text editor and copy its contents (Ctrl+A, Ctrl+C).
- Open Markdown Preview and paste. The formatted page appears beside the source as you type.
- Edit on the left if you need to; the right side updates live.
On Windows:
- Notepad opens any
.mdfile as text. Recent versions of Notepad on Windows 11 can also show Markdown formatted; switch between formatted and syntax views from the View menu or the status bar. - VS Code (free) opens the file; press Ctrl+Shift+V for a formatted preview, or Ctrl+K V to see it side by side.
- To make
.mdfiles always open in one program, right-click a file → Open with → Choose another app, pick it, and tick Always use this app.
On a Mac: TextEdit opens it as text (choose Format → Make Plain Text if it shows oddly). VS Code works the same as on Windows, with Cmd+Shift+V.
On a phone: most file manager apps show it as plain text. For a formatted view, paste it into Markdown Preview in the phone's browser.
How to convert Markdown to HTML
- Open Markdown to HTML and paste the Markdown.
- Switch the right pane from the rendered preview to the HTML source to see the tags.
- Copy the HTML with one click to paste into a CMS, an email template or a web page, or download a complete
.htmlfile that opens in any browser.
To convert a .md file without opening it, drop it on MD to HTML, which also offers plain text and PDF.
A worked example
This Markdown:
## Install
Run **npm install**, then see the [docs](https://example.com).
- Node 20 or later
- 2 GB free space
becomes this HTML:
<h2>Install</h2>
<p>Run <strong>npm install</strong>, then see the <a href="https://example.com">docs</a>.</p>
<ul>
<li>Node 20 or later</li>
<li>2 GB free space</li>
</ul>
Every mark maps to exactly one tag: ## to <h2>, ** to <strong>, the link to <a href>, the dashes to a <ul> list. That one-to-one mapping is why the conversion is lossless in that direction.
Going the other way, and to PDF or Word
- HTML to Markdown works well for ordinary pages: headings, paragraphs, lists, links and tables have Markdown equivalents. Layout, colours and anything inside
<div>styling does not survive, because Markdown has no way to say it. HTML to Markdown does it in the browser. - Markdown to PDF is a two-step job in most tools: Markdown to HTML, then print to PDF. Markdown to PDF does both.
- Markdown to Word: convert to HTML, then open the
.htmlfile in Word and save as.docx. Headings come through as Word heading styles.
Is it safe to preview Markdown from someone else?
Markdown may contain raw HTML, and raw HTML may contain scripts. A careless viewer that renders it as a web page could run that script. A safe previewer strips <script> tags, inline event handlers such as onclick, and javascript: links before showing anything. The Markdown Preview here sanitises every render and every copy, and it does not load images from other websites, so opening a file does not tell anyone that you opened it.
If it doesn't work
- The file opens in the wrong program, or asks which app to use. Windows has no default for
.md. Use Open with → Choose another app and tick Always. - You see the marks, not the formatting. The program is a plain text editor. That is normal; use a preview to see it formatted.
- A table shows as a row of pipes. The line under the header row (
|---|---|) is missing, or the viewer does not support GitHub-flavoured Markdown tables. - A list or heading runs into the paragraph above. Markdown needs a blank line before a list or a heading in many viewers. Add one.
- Characters show as
’or similar. The file is UTF-8 and the editor opened it as another encoding. Reopen it with UTF-8 selected. - The file is actually called README.md.txt. Windows was hiding the real extension. Turn on View → Show → File name extensions in File Explorer and rename it.
Questions people ask
What program opens a .md file?
Any text editor opens a .md file, because Markdown is plain text: Notepad on Windows, TextEdit on a Mac, any notes app on a phone. To see it formatted, use a Markdown viewer such as VS Code's preview (Ctrl+Shift+V), recent Notepad versions on Windows 11, or a browser-based Markdown preview where you paste the contents.
How do I view a Markdown file as formatted text?
Open it in a program that renders Markdown. In VS Code, open the file and press Ctrl+Shift+V. In a browser, paste the contents into a Markdown preview, which shows headings, lists, links and tables as they would appear on GitHub. GitHub and GitLab also render any .md file in a repository automatically when you open it.
How do I convert Markdown to HTML?
Paste the Markdown into a converter and copy the HTML it produces. Each mark becomes one tag: a line starting with ## becomes an h2 heading, text in double asterisks becomes strong, a dash list becomes a ul list. The Markdown to HTML tool here also downloads a complete .html file that opens in any browser.
Can Word open a Markdown file?
Word opens a .md file only as plain text, showing the marks rather than the formatting. To get a formatted Word document, convert the Markdown to HTML first, open the .html file in Word, and save it as .docx. Headings arrive as Word heading styles, and lists and links are kept.
What is the difference between Markdown and GitHub-flavoured Markdown?
GitHub-flavoured Markdown is CommonMark with extensions GitHub added: tables, task-list checkboxes, strikethrough with double tildes, and links made automatically from bare URLs. A file written for GitHub uses these freely, so a viewer that follows only basic Markdown shows tables as lines of pipes. Most modern viewers support both.
Sources
Checked 5 Oct 2026:
- CommonMark Spec, version 0.31.2 (headings, emphasis, lists, links, code)
- GitHub Flavored Markdown Spec (tables, task lists, strikethrough, autolinks)
- Visual Studio Code: Markdown and Visual Studio Code (Ctrl+Shift+V preview, Ctrl+K V side by side)
- Windows Insider Blog: Text formatting in Notepad begin rolling out to Windows Insiders (Markdown formatting and the formatted/syntax toggle)
- John Gruber: Markdown (the original syntax and its aim of readable plain text)