All posts
Document Parsing

Why PDFs break LLMs — and what clean Markdown fixes

Jun 12, 2026 · The markitdown.ai team · 3 min read

A PDF renders perfectly for a human and falls apart the moment a model reads it. The page you see — columns, tables, headers, footnotes — is a visual arrangement, not a logical one. When you pull raw text out of it, that visual order rarely survives, and whatever you feed a language model is only as good as the text it actually receives.

What actually goes wrong

When teams pipe documents straight into an LLM or a retrieval index, a few failure modes show up again and again:

  • Reading order breaks. Multi-column layouts interleave. A two-column page becomes "line 1 left, line 1 right, line 2 left, line 2 right…", so a sentence a human reads top-to-bottom arrives at the model scrambled.
  • Tables collapse. Copy-paste turns a table into a loose run of numbers. The relationship between a header and its cell — the entire point of a table — is gone.
  • Headings disappear. The visual hierarchy (this is a section, this is a subsection) is encoded as font size and weight, not structure. Strip the styling and you get one undifferentiated wall of text.
  • Noise creeps in. Page numbers, running headers, hyphenated line breaks, and stray ligatures end up inline, polluting prompts and embeddings alike.

None of this is exotic. It's the default outcome of treating a layout format as if it were a content format.

Why it matters more for AI than for people

A person skims past a misplaced page number. A retrieval pipeline does not. Chunking, embedding, and ranking all assume the text is coherent — that adjacent tokens are actually adjacent ideas. When reading order is scrambled, chunks straddle unrelated content, embeddings blur, and retrieval surfaces the wrong passage. The model then reasons confidently over text that never existed in that order.

The failure is quiet, too. Conversion "works" — you get text out — so the problem only shows up later as vague answers, wrong citations, or a RAG system that's mysteriously worse on PDFs than on plain text.

What clean Markdown fixes

Markdown is a content format: headings, lists, and tables are explicit, not implied by styling. Converting a document into structure-aware Markdown before it touches a model does three things:

  1. Reconstructs reading order so the text matches the document a human sees.
  2. Preserves tables and headings as real Markdown, so structure survives chunking.
  3. Drops the noise — page furniture and broken hyphenation — that would otherwise leak into prompts.

The result is predictable input. Chunk it, embed it, or paste it into a prompt, and the model sees the same clean structure every time, across thousands of documents, instead of failing on the messy ones.

The practical takeaway

If your AI pipeline ingests documents, treat "document → clean Markdown" as its own step, not an afterthought buried inside extraction. It's the cheapest reliability win available: get the text right once, and everything downstream — retrieval, summarization, extraction — gets easier.

That conversion step is exactly what markitdown.ai does. Try a file in the browser, or wire it into your pipeline with the API.

Turn a document into Markdown

Free in your browser, no sign-up. Sign in for saved history, batch, and the API.