PDF vs Markdown for AI: which file format to give a model
For text, Markdown is the stronger file format for AI because the model gets exactly your words and structure. PDF wins when charts, scans or layout matter.

For text, Markdown is the stronger file format for AI: the model receives exactly the characters you wrote, headings and tables arrive as structure, and every token goes to content. PDF is the better choice when the meaning lives in the page itself, such as a chart, a scanned form or a layout, because the major AI APIs send a picture of each page along with its extracted text. When a document matters, keep both: the PDF as the record and a Markdown copy as the version you and the AI work from.
The rest of this post explains what each model API does with a PDF, what that costs, and how to decide per document.
What happens when you give an AI model a PDF?
The model never reads the PDF file as such. The service in front of it takes the file apart first, and the three large API providers describe the same approach in their documentation (checked November 2026):
- Anthropic (Claude). The PDF support page says "the system converts each page of the document into an image" and "extracts the text from each page and provides it alongside that page's image." Because PDF reading relies on vision, it is "subject to the same limitations and considerations as other vision tasks."
- OpenAI. The PDF files guide says "the API extracts both text and page images and sends both to models that accept image inputs," and notes that this "can increase token usage."
- Google (Gemini). The document processing page says embedded PDF text "is extracted alongside page images."
So a PDF reaches the model as two things at once: text pulled out of the file, and an image of every page. The text is only as good as the extraction. Two-column layouts, running headers, footnotes and tables are where it goes wrong, which is the same problem converting a PDF to Markdown runs into. The page image lets the model look at what the extraction missed, which is why charts and diagrams in a PDF can be discussed at all.
A scanned PDF has no text layer, so the model has only the page images to read.
These pages describe the APIs. Chat apps like ChatGPT, Claude and Gemini handle uploads their own way and do not document their pipeline in the same detail, so treat the API behavior as a guide rather than a promise about the app.
What happens when you give it a Markdown file?
It is read as text, and nothing else is added. Gemini's documentation puts it directly: "Plain-text formats such as TXT, Markdown, and HTML are read as text only, without layout or chart context." Anthropic's PDF page notes that ".txt, .csv, or .md" files can be sent as plain-text documents.
For Markdown, "text only" loses less than it sounds. The structure is written in the characters themselves: ## marks a heading, - a list item, | a table column. The model sees those marks the same way it sees the words, and it writes the same marks back in its answers. That is the case made in why Markdown is the language of AI. A PDF carries its structure as positions on a page, which has to be reconstructed by extraction or read off the image.
How do PDF and Markdown compare for AI work?
| Markdown | ||
|---|---|---|
| What the model receives | Extracted text plus an image of each page | The file's text, exactly |
| Headings and lists | Inferred from font size and position | Written as # and - |
| Tables | Often flattened or split by extraction; visible in the page image | Pipe tables, read row by row |
| Charts, diagrams, photos | Visible in the page image | Absent unless described in text |
| Scanned pages | Page images only | Not applicable |
| Token cost | Text tokens plus image tokens per page | Text tokens only |
| AI edits the file | Not practical | Yes, line by line |
| Reviewing a change | Compare two PDFs | git diff or any text diff |
| Pointing to a passage | Page numbers | Headings and line numbers |
How many tokens does a PDF page use compared with Markdown?
The providers publish their own figures, and they differ:
- Claude: text from a page typically uses 1,500 to 3,000 tokens depending on content density, and each page's image uses at most 1,568 visual tokens.
- Gemini 3 and 4: "about 280 tokens per page at
low, 560 atmedium(default), or 1,120 athigh." For Gemini 2.5 the page lists a "flat 258 tokens per page." - OpenAI: both the extracted text and the page images count toward context. The guide gives no per-page figure.
A Markdown version of the same document costs only its text. Whether that saving matters depends on how often the document is sent. A contract you ask about once is cheap either way. A 40-page handbook attached to every conversation, or a folder of reports an agent reads in a loop, pays the image cost every time. Count both versions of one of your own files with the provider's token counter before deciding; how many tokens a Markdown file uses shows how.
When is PDF the better format for AI?
Send the PDF when the page itself carries information the text cannot:
- Charts and diagrams whose point is the shape of a line or the arrows between boxes.
- Scanned documents, handwritten notes and photos of paper, where there is no text to extract anyway.
- Forms and layouts where position means something: a filled-in form, an invoice, a floor plan.
- Documents you need quoted by page, such as a contract or a paper you will cite. Anthropic's prompting guide suggests using "logical page numbers (from PDF viewer) in prompts."
- One-off questions. If you will ask about a file once, converting it first is more work than it saves.
When is Markdown the better format for AI?
Use Markdown when the text is what matters and you will come back to it:
- Notes and knowledge bases that you search, link and give to AI repeatedly.
- Context that goes into many prompts, where the per-page image cost adds up.
- Documents an AI agent edits. An agent can change one line of a
.mdfile and you can see exactly which line changed. A PDF has to be regenerated. - Tables you will compute from. A pipe table is already rows and columns; a PDF table has to be rebuilt first.
- Drafts. Anything still being written is easier to revise, diff and export from Markdown.
How do you keep both without doubling the work?
Convert once, check the result against the original, and keep the two files side by side. A small block of front matter at the top of the Markdown file records where it came from:
---
source: reports/2026-q3-board-report.pdf
converted: 2026-11-27
checked: tables on pages 4 and 9 against the PDF
---
# Q3 board report
## Revenue by region
| Region | Q2 | Q3 |
|---|---|---|
| EMEA | 1.2M | 1.4M |
| APAC | 0.9M | 1.0M |
A folder then looks like this:
reports/
2026-q3-board-report.pdf
2026-q3-board-report.md
Give the AI the .md for questions about the text. When a question is about a chart on page 6, send the PDF, or describe the chart in a sentence in the Markdown file so the text version carries it too.
Word files need a step first: Anthropic's documentation says .docx is "not supported in document blocks," so convert it to text or PDF, or to Markdown with a converter such as Pandoc.
Common questions
How large a PDF can an AI API take?
Limits differ by provider (checked November 2026). Claude accepts up to 600 pages per request, or 100 when the request's context window is under 1M tokens, within a 128 MB request on the first-party API. Gemini takes up to 1,000 pages and 50 MB per PDF. OpenAI's limit is 50 MB per file and 50 MB for all files in one request.
Does a dense PDF fit even when it is under the page limit?
Not always. Anthropic warns that "dense PDFs (many small-font pages, complex tables, or heavy graphics) can fill the context window before reaching the page limit," and suggests splitting the document into sections.
PDFs and Markdown side by side in Noteline
Noteline, which we make, has no AI features and does not convert PDFs, so use a converter for that step. What the desktop app does is keep both files in one place: open your folder with File > Open Folder… (Cmd+O on a Mac, Ctrl+O on Windows and Linux), and PDFs appear in the sidebar next to your .md files. A PDF opens in a built-in viewer in its own tab, so you can read the original in one tab while you correct the converted Markdown in the next, and tables in the Markdown show as an editable grid. Your notes stay plain .md files in that folder, ready to attach to whichever AI tool you use. The iPhone, iPad and Android apps are free and edit Markdown, but they do not open PDFs.