The short answer
- Markdown is a plain-text writing format that represents document structure with text symbols and can be converted to HTML, but compatibility between variants is not guaranteed.
- On Windows or Mac, open the file from a plain-text editor's Open command. On a phone, use an app that can open plain-text files. Reading the source does not require HTML conversion. For formatted browser viewing, use a converter that supports the document's Markdown variant and inspect its HTML output.
- Plain-text viewing has relatively low risk, but malicious Unicode control characters can alter the displayed text direction. HTML previews can introduce script execution, redirects, remote downloads and personal-information uploads. Check the output and use a viewer that sanitizes or blocks risky markup; see [RFC 7763, section 2](https://www.rfc-editor.org/rfc/rfc7763.html#section-2).
Markdown files (.md, .markdown): opening and conversion
Files ending in .md or .markdown contain readable source text. The original syntax supports headings, lists, quotations, code, emphasis, links and images. See the [original Markdown description](https://daringfireball.net/projects/markdown/).
Convert the source with a Markdown-to-HTML converter that supports its variant, then inspect the result. The original syntax permits embedded HTML, but Markdown inside block-level HTML is not parsed. See the [Markdown syntax documentation](https://daringfireball.net/projects/markdown/syntax).
How to open it
On Windows or Mac, open the file from a plain-text editor's Open command. On a phone, use an app that can open plain-text files. Reading the source does not require HTML conversion. For formatted browser viewing, use a converter that supports the document's Markdown variant and inspect its HTML output.
On Windows or Mac, open the file from a plain-text editor's Open command. On a phone, use an app that can open plain-text files. Reading the source does not require HTML conversion. For formatted browser viewing, use a converter that supports the document's Markdown variant and inspect its HTML output.
Convert the source with a Markdown-to-HTML converter that supports its variant, then inspect the result. The original syntax permits embedded HTML, but Markdown inside block-level HTML is not parsed. See the [Markdown syntax documentation](https://daringfireball.net/projects/markdown/syntax).
File safety
Plain-text viewing has relatively low risk, but malicious Unicode control characters can alter the displayed text direction. HTML previews can introduce script execution, redirects, remote downloads and personal-information uploads. Check the output and use a viewer that sanitizes or blocks risky markup; see [RFC 7763, section 2](https://www.rfc-editor.org/rfc/rfc7763.html#section-2).
An unknown sender, a name ending in two extensions, or contents that do not match the extension — check before you open it.
Converting it
Convert the source with a Markdown-to-HTML converter that supports its variant, then inspect the result. The original syntax permits embedded HTML, but Markdown inside block-level HTML is not parsed. See the [Markdown syntax documentation](https://daringfireball.net/projects/markdown/syntax).
Convert a copy, never the original, then compare quality, metadata, and layout against what you started with.
Common questions
What is a Markdown file used for?
A Markdown file stores writing as plain text with symbols for structures such as headings, lists and links. Its common extensions are .md and .markdown, and it can be converted to HTML.
How do I open an MD file on Windows?
Open a plain-text editor, choose Open and select the .md file. You can read and edit its source; a formatted view requires a Markdown renderer.
How do I open a Markdown file on Mac?
Use a plain-text editor's Open command to select the file. Read it as source text, or use a compatible Markdown renderer for a formatted view.
How do I open a Markdown file on a phone?
Open it in an app that supports plain-text files. For a formatted view, choose a Markdown-capable app and check which variant it supports.
How can I preview Markdown online in a browser?
Use a Markdown previewer that supports the file's variant, or convert the file to HTML and view that output in a browser. Upload behavior and HTML filtering depend on the service.
Why does Markdown formatting change between editors?
Editors may use different Markdown variants. A renderer may ignore or interpret unfamiliar syntax differently. Check variant support and, for original Markdown, check whether the affected text is inside block-level HTML.
Should I use Markdown or HTML for a document?
Choose Markdown for readable plain-text writing with simple structural symbols. Choose HTML when you need to express the page markup directly; Markdown can be converted to HTML.
How do I convert Markdown to HTML without losing formatting?
Use a converter compatible with the source variant, then compare the output with the source. Formatting preservation is not guaranteed across variants, and original Markdown does not parse Markdown markers inside block-level HTML.
Can a Markdown preview allow HTML script execution?
Yes. Rendering embedded HTML can introduce script execution and other HTML risks if the viewer permits it. Use output sanitization or markup blocking, and inspect unfamiliar files as plain text first.
What is the Markdown file MIME type, and does it have a magic number?
RFC 7763 registers text/markdown with the extensions .md and .markdown. It specifies no magic number, so there is no fixed identifying byte signature.
Related formats
Sources
Daring Fireball: Markdown · 格式原作者 John Gruber 的官方网站
Markdown Syntax Documentation · 格式原作者发布的语法说明
RFC 7763: The text/markdown Media Type · IETF 发布的 Markdown 媒体类型注册文档