Markdown formatting token overhead calculator
Markdown is great for humans, but every #, *, backtick and | is a billable
token — and on output you pay for all of them. This tool counts your text
with markdown, strips the syntax to get the plain-text equivalent, and
shows the exact overhead so you can decide where formatting earns its tokens.
How it works
The calculator counts tokens for your markdown as written, then removes the
formatting syntax with a markdown-stripping pass: headers (#), emphasis
(*/_), list markers, links and images, inline and fenced code, blockquotes
and table pipes. It counts the cleaned text and reports the difference in tokens
and as a percent of the formatted total. Counts use the ≈ 4-characters-per-token
heuristic that tracks GPT and Claude tokenizers for English.
Most of the cost comes from repeated markers — a 50-row bullet list or a heavily nested document pays the marker tax on every line.
Tips to control formatting cost
- Match format to consumer. Code reading the output? Ask for plain text or JSON. Human reading rendered markdown? Keep it.
- Flatten deep nesting. Multiple indent levels and decorative dividers add tokens without improving comprehension.
- Prefer compact lists. A short comma-separated line is cheaper than ten one-item bullets when the structure is not load-bearing.
- Cap output tokens. Combine
max_tokenswith a plain-format instruction to stop formatting from inflating long completions.
Where formatting overhead actually hurts
The overhead from Markdown varies enormously by content shape. For a single short paragraph, the difference between formatted and plain text might be two or three tokens — negligible. The problem scales with structure:
Bullet-heavy documents pay the highest penalty. A 50-item bullet list has a - marker on every line. If you generate thousands of such responses — a product description generator, a FAQ builder, an item-extraction pipeline — those markers compound into meaningful cost. In many cases a numbered or comma-separated plain list is identical in value to the user and measurably cheaper.
Tables are expensive. Every | character in a Markdown table is a token, and a table with 6 columns and 20 rows can have over 100 pipe characters, plus the header separator row (| --- | --- |). If your downstream consumer is code that parses the data, JSON or CSV is always cheaper and more reliable to parse.
Nested headings and decorative dividers add tokens with no functional value in code-consumed outputs. A response that uses ## Overview, ### Key Points, and --- dividers is substantially more expensive than the same content in plain paragraphs when the UI does not render Markdown.
When formatted output is worth the tokens
Not all formatting overhead is waste. In human-facing interfaces where Markdown is actually rendered:
- Headings create navigable structure in long responses — a real user value.
- Code blocks with language hints enable syntax highlighting and clear delineation — useful and not easily replaced.
- Bold emphasis aids scanning — worth a few tokens per sentence.
The rule is: formatting earns its tokens when a human reads rendered output. If any layer in the pipeline (a database, a transform function, another LLM call, a customer-facing email) receives the raw Markdown string before rendering, the formatting is overhead. This tool helps you quantify that overhead for your specific content so you can make the trade-off deliberately rather than by default.