PDF to Markdown

Turn a PDF into clean Markdown with real # headings, bullet and numbered lists and GitHub-flavoured tables - reconstructed from the page's actual font sizes and column positions, not guessed from a flat text dump. Made for people who convert a PDF to Markdown to save tokens before pasting it into ChatGPT, Claude, Gemini, DeepSeek or Grok.

How the structure is actually detected

A PDF has no headings, no lists and no tables. It only has glyphs at coordinates. So instead of dumping text, this converter reads every text run together with its position, font size and font name, and rebuilds the structure from that:

  • Headings by font-size clustering. The size covering the most characters in the whole document is the body text. Distinct sizes clearly above it become #, ##, ### in descending order. Short, bold, standalone lines at body size are picked up as sub-headings too.
  • Lists from their leading glyph. A line starting with •, -, * or “1.” / “2)” becomes a real Markdown list item, and wrapped continuation lines are folded back into the item they belong to.
  • Tables by x-position clustering. An x-coordinate where several different rows all start a text run is a real column. A block needs three or more consecutive rows agreeing on at least two columns before it is emitted as a table - and if the resulting grid is mostly empty, it is reported as uncertain and left as plain text rather than turned into a wrong-looking table.
  • Noise removal. Lines repeating at the top or bottom of most pages are running headers and footers, so they are dropped (page numbers are matched by shape, so “Page 3 of 12” and “Page 4 of 12” count as the same line). Words split across a line break with a hyphen are rejoined.

Page boundaries are preserved as <!-- page 2 --> HTML comments rather than visible headings, because a “## Page 2” would be read by a Markdown parser - and by a language model - as real document structure that does not exist.

الأسئلة الشائعة

Why convert a PDF to Markdown before using ChatGPT or Claude?

Because Markdown says the same thing with less noise and more structure. A raw PDF text dump repeats the running header and footer on every page, splits words across line breaks with hyphens, and gives the model one short line per visual line with no indication of what was a heading, a list or a table. Markdown headings and tables tell the model exactly how the document is organised, which improves the answers you get - and dropping the page furniture means you are not paying tokens for text that carries no meaning.

Does converting to Markdown really reduce tokens for AI?

It depends on the document, and this tool shows you the real number rather than a marketing claim. The clear wins are removing repeated headers and footers, re-flowing hard-wrapped lines, and rejoining hyphenated words (a word split as "through-" plus "put" is tokenized as several fragments instead of one). Against that, table pipes and heading markers add a few characters back. On a long report with page furniture on every page the saving is real; on a short, clean, table-heavy PDF the Markdown can come out about the same size - and it is still far more useful to the model. The tool shows an estimate (about four characters per token) labelled as an estimate.

Will it detect headings and tables in my PDF?

Headings are detected whenever the document uses larger or bold type for them, which covers almost every report, paper, manual and contract exported from Word, Google Docs, LaTeX or InDesign. Tables are detected when their columns line up consistently down the page - the usual case. Tables held together only by drawn borders with no consistent text alignment, and heavily designed magazine-style layouts, are the hard cases; when the grid looks unreliable the tool says so and keeps the text rather than inventing a table.

Can I turn parts of the detection off?

Yes. Heading detection, list detection, table detection, hyphenation rejoining, bold/italic and the running header removal are all individual toggles, plus an option to add <!-- page N --> markers. The PDF is only read once, so every toggle re-converts instantly and the token estimate updates with it.

What happens with a scanned PDF?

A scanned PDF is a picture of a page with no text layer, and there is no OCR step here, so nothing can be extracted from it. The tool tells you plainly which pages had no text layer instead of silently returning an empty file. Run the PDF through an OCR tool first and then convert the result.

Is my PDF uploaded to a server?

No. The PDF is parsed with pdf.js entirely inside your browser, and the Markdown is built there too. The file never leaves your device, which also means confidential contracts and internal reports are safe to convert here.

Can I use the Markdown in a RAG pipeline?

That is one of the main reasons to use it. Markdown headings give a chunker natural split points - split on ## boundaries first, then paragraphs - so chunks line up with real sections instead of cutting mid-sentence, and tables stay readable to the model after chunking. Download the .md, or copy it straight out of the tool.

أدوات ذات صلة