Why Markdown is the best format for AI models
When you give a document to ChatGPT, Claude or Gemini, the model reads plain text. HTML wastes much of that text on tags, classes and scripts. Text copied from a PDF loses its headings and comes with page numbers and broken lines. Markdown sits in between: it marks structure with a few characters (# for a heading, - for a list item, | for a table) and keeps everything else as readable text.
That has two benefits. The model sees where sections start and which items belong together, so its answers cite and summarise more accurately. And you pay for fewer tokens. A typical article saved as HTML can be five to ten times larger than the same article in Markdown.
What each converter does
Word (.docx). A .docx file is a ZIP archive of XML files. The tool unzips it in your browser (with the fflate library) and reads the main document part:
| In Word | In Markdown |
|---|---|
| Title, Heading 1–6 styles (any language) | # to ###### headings |
| Bold, italic, strikethrough | **bold**, *italic*, ~~strike~~ |
| Bulleted and numbered lists, nested | - and 1. lists, indented 4 spaces per level |
| Tables, including merged cells | GitHub-style pipe tables |
| Hyperlinks and HYPERLINK fields | [text](url) |
| Code or monospaced text | code spans and fenced code blocks |
| Pictures | [Image: alt text] markers (optional) |
Headings are found through the document’s style definitions, not their names, so a German “Überschrift 1” or a custom style based on Heading 2 still becomes a heading. Tracked deletions, comments, page breaks, headers and footers are left out.
HTML. Web pages are parsed by your browser’s own HTML parser, then walked element by element. Scripts, styles, forms and hidden elements are dropped. With Main content only on, the tool also skips navigation, site headers, footers and sidebars. If the page has a single <main> or <article> element, it converts just that. You can also paste straight from a browser, Word or Google Docs: the clipboard carries the formatted version, and the tool converts it instead of the plain text.
PDF. A PDF has no headings or paragraphs, only text placed at positions in certain sizes. The tool rebuilds lines from the positions with PDF.js, then:
- finds the body text size (the size used by most characters);
- turns lines clearly larger than the body, at least 15% bigger, into headings, with the largest size as
#; - treats lines starting with •, –, 1. or a) as list items;
- joins wrapped lines into paragraphs and repairs words hyphenated at line ends (“quar-” + “ter” → “quarter”);
- removes page numbers, and header or footer lines that repeat on at least half the pages.
Scanned PDFs have no text layer. Convert their pages to images and use image to text first, or extract the raw text with PDF to text.
Worked example
A Word file containing a title, a bold word, a two-level list and a link:
Annual report (Title style)
Sales grew fast in 2026. (“fast” in bold)
• Apples
1. Step one
2. Step two
Read the docs (linked to example.com/docs)
becomes:
# Annual report
Sales grew **fast** in 2026.
- Apples
1. Step one
2. Step two
Read the [docs](https://example.com/docs).
The Markdown is 132 characters and 42 tokens (o200k_base). The same content as Word’s internal XML is several kilobytes.
Tips for better results
- Use real heading styles in Word rather than big bold text. Styles become proper
#headings; manual formatting becomes a bold paragraph. - Check tables from PDFs. Columns in a PDF are just text at different positions, so complex tables may come out as plain lines. Fix them in the output box before copying.
- Remove what the model doesn’t need. Appendices, legal boilerplate and repeated disclaimers all cost tokens. You can edit the Markdown directly in the result box.
- Measure before you send. Paste the result into the LLM token counter or the context window checker to see whether it fits your model.
- Publishing docs for AI tools? Markdown copies of your pages are what an llms.txt file should point to.
Privacy
Files are opened and converted inside your browser tab. Nothing is uploaded, so you can safely convert contracts, medical letters or internal reports before deciding what to share with an AI service.