Markdown Font Size: Make Text Bigger or Smaller (2026)
September 11, 2026 · 9 min read
Markdown Font Size: How to Make Text Bigger or Smaller
There is no markdown font size syntax; size comes from the renderer's CSS. That leaves three levers: heading levels for bigger text, inline HTML such as <span style="font-size:…"> or <small> where the platform allows it, and CSS at the render layer. Which one works depends on whether the host strips HTML.
Does Markdown Have a Font Size Setting?
No. The CommonMark spec defines headings, emphasis, lists, code, links, and images, and nothing about type size or family. What it does define is raw HTML: text that looks like an HTML tag passes through to the output unchanged. That's the door every font trick walks through.
The consequence is that "change the font size in Markdown" always means one of three things. Pick a different heading level, which is real Markdown. Write an HTML tag, which is Markdown passing something through. Or change the stylesheet of whatever renders the file, which isn't Markdown at all. Markdown fonts work the same way: there's no font-family syntax either.
Whether the second option survives depends on the platform's HTML sanitizer, the same mechanism that decides whether coloured text renders. Our Markdown text colour post covers that story in full; this one stays on size.
Heading Levels: The Only Size Control in Pure Markdown
Six heading levels give you six sizes that render everywhere, from GitHub to Obsidian.
# Largest
## Large
### Medium
#### Slightly larger than body
##### About body size
###### Smallest heading
GitHub's stylesheet renders # at roughly twice the body size, ## at 1.5 times, ### at 1.25 times, #### at body size, and ###### slightly smaller in a muted colour. Exact sizes differ by site, but the ordering holds.
The catch is semantic: headings build the document outline, so a #### used only for big text adds a fake section that screen readers and table-of-contents generators pick up. Use them for real sections and reach for HTML when you want a big line of text that isn't a heading. Our Markdown headings guide covers the rules.
Inline HTML: span, font, and small
Where raw HTML with attributes renders, a span with a style attribute is the direct answer.
<span style="font-size:24px">Bigger text</span>
<span style="font-size:0.8em">Smaller text</span>
<span style="font-family:Georgia, serif">A different markdown font</span>
<font size="5">Bigger with the old font tag</font>
The first line renders at 24 pixels, the second at 80 percent of the surrounding text, and the third in Georgia. The <font> tag is deprecated HTML, but browsers still honour it; it's the form you'll find in older README answers.
Two rules from the spec: don't indent the HTML four spaces or it becomes a code block, and don't expect **bold** to render inside the tag on every platform. Obsidian's HTML help page states it doesn't render Markdown syntax inside HTML elements, for example.
Three tags matter for markdown small text because they carry meaning rather than styling: <small> for fine print, <sub> for subscripts, and <sup> for superscripts. Sanitizers that strip style often keep these, which is why they're the GitHub-safe route in the next sections.
CSS and Document Settings: Pandoc, R Markdown, and Style Blocks
When you control the renderer, change the stylesheet instead of the document. A <style> block at the top of a file works in viewers that don't sanitize, such as our editor or a Pandoc HTML export.
<style>
body { font-size: 18px; }
pre, code { font-size: 0.85em; }
</style>
For Pandoc, the manual's variables list fontsize for HTML output, which sets the base CSS font size in px or pt, and mainfont for the family. The manual notes that 12pt equals 16px in most browsers. For LaTeX and PDF output, fontsize accepts 10pt, 11pt, or 12pt with the standard document classes; other sizes need a KOMA-Script class such as scrartcl. In R Markdown the same variable goes in the YAML header.
---
title: "Report"
output: pdf_document
fontsize: 12pt
---
Our R Markdown YAML header guide covers the other output options, and the Markdown CSS post shows how to style rendered HTML for the web.
Try Markdown Font Size Changes in the Editor
Our editor passes raw HTML through to the preview without stripping attributes, so every method above renders here. That makes it a quick test bench: paste your snippet, see the size change, then check the platform table before you commit it somewhere stricter.
The limitation is the same one that makes this demo work: because nothing is stripped here, the preview can't warn you that GitHub will drop your style attribute. Treat it as a rendering check, not a compatibility check.
Which Platforms Keep Font Size Changes?
This table is what nobody publishes, so here it is, drawn from each platform's documentation and, for our editor, from its renderer.
| Platform | Heading levels | <span style> | <small>, <sub>, <sup> | Notes |
|---|---|---|---|---|
| GitHub | Yes | Stripped | Yes | style is removed; use headings for big text |
| GitLab | Yes | Stripped | Yes | Uses a similar allowlist with a few extra tags |
| Obsidian | Yes | Yes | Yes | Inline styles and CSS snippets, per its HTML help page |
| VS Code preview | Yes | Yes | Yes | Inline styles render; scripts are blocked |
| Jupyter Markdown cells | Yes | Yes | Yes | JupyterLab keeps inline styles; nbviewer may sanitize more |
| Notion, Slack, Discord | Notion yes, Discord # to ###, Slack none | No | No | No raw HTML; Discord's -# subtext is the one chat-app small-text syntax |
| Pandoc HTML / R Markdown | Yes | Yes | Yes | Or set fontsize once for the document |
| Home Assistant Markdown card | Yes | Undocumented | Yes | Marked renderer; HTML yes, JavaScript no |
The GitHub row is the one people search for. The project's Markup README says the HTML is sanitized "aggressively", removing inline styles and class or id attributes. The html-pipeline allowlist it relies on keeps small, sub, and sup while dropping font and style. So on GitHub you can make text smaller, but bigger text means a heading. Our GitHub Markdown cheat sheet lists everything else GitHub keeps and drops.
One hack you'll see in READMEs is math sizing, such as $\Large{text}$, which GitHub's MathJax renderer accepts. It's fragile, unselectable as text, and read aloud as an equation, so we don't recommend it.
How Do I Make Text Small in Markdown?
Use <small>, <sub>, or <sup>. They're semantic HTML, so sanitizers keep them, and they shrink text on GitHub, GitLab, Obsidian, VS Code, and Jupyter alike.
<small>Last updated 2026-09-11. Prices exclude tax.</small>
Water is H<sub>2</sub>O. Area is r<sup>2</sup> times pi.
<sub>This line renders as a tiny subscript, a common footer trick on GitHub.</sub>
<small> renders at about 80 percent of body size in most stylesheets. <sub> and <sup> also shrink text and shift it below or above the baseline, which is why some READMEs wrap a whole footer line in <sub> to get quiet grey text. Where HTML is allowed with styles, <span style="font-size:0.8em"> gives you exact control.
Three mistakes cause most "it didn't work" reports. Writing <span style="font-size:24px"> on GitHub and seeing normal text: the style was stripped, and only a heading makes text bigger there. Indenting an HTML block by four spaces, which turns it into a code sample. And putting **bold** inside a span on Obsidian, where Markdown inside HTML isn't parsed; use <strong> instead.
Markdown Font Size FAQ
Changing markdown font size comes down to knowing which lever your platform honours. Heading levels work everywhere, semantic tags like <small> survive GitHub, inline styles render in Obsidian and VS Code, and a stylesheet or fontsize variable applies when you own the renderer. Test the snippet in the editor first, then check the table before you paste it into a README.