Skip to content
KazamTools

Document to Markdown Converter

Turn Word, web pages and PDFs into clean Markdown that language models read well, without uploading anything.

Files are processed in your browser and never uploaded.How it works

DOCX, HTML, PDF or TXT · converted on your device

How to use the Document to Markdown

  1. 1Choose a .docx, .html, .pdf or .txt file, or switch to Paste and paste from a web page, Word or Google Docs.
  2. 2Leave Main content only on to drop menus, headers and footers from web pages.
  3. 3Check the Markdown, edit it if you like, then Copy it or Download .md.
  4. 4Count its tokens or check it fits a model’s context window with the links below the result.

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:

  1. finds the body text size (the size used by most characters);
  2. turns lines clearly larger than the body, at least 15% bigger, into headings, with the largest size as #;
  3. treats lines starting with •, –, 1. or a) as list items;
  4. joins wrapped lines into paragraphs and repairs words hyphenated at line ends (“quar-” + “ter” → “quarter”);
  5. 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.

Common conversions

Frequently asked questions

Why convert documents to Markdown for an LLM?

Markdown keeps the structure that helps a model understand a document (headings, lists, tables and links) with very little extra text. It usually uses far fewer tokens than HTML and is cleaner than text copied out of a PDF.

What is kept from a Word document?

Headings (from heading styles, in any language), bold, italic and strikethrough, bulleted and numbered lists with nesting, tables, hyperlinks, line breaks and code-style paragraphs. Images become [Image: alt text] markers. Comments, tracked deletions, headers and footers are left out.

How well does PDF to Markdown work?

A PDF stores positioned text, not structure, so the tool guesses: larger text becomes headings, bullet and number lines become list items, wrapped lines are joined, and repeated headers, footers and page numbers are removed. Tables and multi-column layouts may need tidying by hand.

Can it convert old .doc files?

No. Open the file in Word, LibreOffice or Google Docs, save it as .docx, then convert that.

Are my files uploaded?

No. Everything is converted in your browser. That matters for contracts, reports and other private documents you plan to give to an AI model.

Was this tool helpful?