text/markdown text/markdown means: text/markdown is the registered media type for Markdown, a lightweight plain-text markup language that converts to HTML. RFC 7763 registers the type with a variant parameter for the many Markdown dialects, and it is the standard format for documentation, READMEs and static-site content. Text media types carry human-readable character data. Because they are text, the charset parameter matters: without an explicit charset=utf-8, receivers may guess a legacy encoding and mangle non-ASCII characters. Text types are also the ones browsers render or display inline, so the subtype decides whether content is treated as markup, code, or plain prose. You will encounter text/markdown in contexts such as documentation, readme and wiki source files; static-site generator content (astro, hugo, jekyll); blog posts and notes authored in plain text. It is commonly associated with the file extension(s) .md, .markdown. Markdown has many incompatible dialects (CommonMark, GFM, MultiMarkdown); the variant parameter can declare which one. When serving Markdown for rendering, convert to text/html; serving raw text/markdown displays the source unless the client renders it.
When you'll see text/markdown
- Documentation, README and wiki source files
- Static-site generator content (Astro, Hugo, Jekyll)
- Blog posts and notes authored in plain text
How to handle it
When serving a text type, always declare charset=utf-8 unless the specification fixes another encoding, and escape or sanitize content according to how it will be rendered. Treat text/html as executable: never inject untrusted strings into it without encoding. For text/plain and text/csv, preserve line endings and quoting rules so downstream parsers do not split fields incorrectly, and set Content-Disposition when you want a download instead of inline display. As a final checklist for text types: declare charset=utf-8 everywhere, normalize line endings for cross-platform consumers, escape output for the rendering context to prevent injection, and set Content-Disposition deliberately so browsers either display inline or download rather than guessing.
Notes & gotchas
Markdown has many incompatible dialects (CommonMark, GFM, MultiMarkdown); the variant parameter can declare which one. When serving Markdown for rendering, convert to text/html; serving raw text/markdown displays the source unless the client renders it.
Examples
HTTP/1.1 200 OK
Content-Type: text/markdown; charset=utf-8
Content-Length: 76
Sample text/markdown content delivered with the correct Content-Type header. curl -i -H "Accept: text/markdown" https://api.example.com/v1/resource # inspect the returned Content-Type const res = await fetch("/v1/resource", { headers: { Accept: "text/markdown" } });
// verify res.headers.get("Content-Type") starts with "text/markdown"
const text = await res.text(); // handle according to the declared type import requests
res = requests.get("https://api.example.com/v1/resource",
headers={"Accept": "text/markdown"}, timeout=10)
res.raise_for_status()
# confirm the server declared the expected type
assert res.headers["Content-Type"].startswith("text/markdown")
text = res.text # decode/handle according to the type Frequently asked questions
Is text/markdown the same as text/x-markdown?
text/x-markdown is an older unregistered alias; RFC 7763 registers text/markdown, optionally with a variant parameter. Prefer the registered form.
Why does my Markdown show as raw text in the browser?
Because browsers do not render Markdown natively. Convert it to HTML at build time (as static-site generators do) or serve text/html; text/markdown delivers the source.
Do I need to specify charset for text types?
Yes — append ; charset=utf-8 unless the type defines its own encoding rules. Without it, receivers may fall back to a legacy encoding and corrupt non-ASCII characters. UTF-8 is the safe default for the modern web.
What is the difference between text/plain and text/html?
text/plain is displayed verbatim with no markup interpretation; text/html is parsed as a document, executing styles and scripts. Serving user content as text/html when you meant plain text is a cross-site scripting risk.
Why do my non-ASCII characters appear corrupted?
The receiver guessed the wrong encoding because no charset was declared. Send charset=utf-8 in the Content-Type, ensure the bytes are actually UTF-8, and for HTML add a matching meta charset tag.
Try the Text Diff
Highlight additions and removals between two texts.