The Best Document Format for ChatGPT, Tested With Real Files

By pdftomd.tools team · Updated · 7 min read

For text documents, the best document format for ChatGPT is clean Markdown: headings, lists and tables survive as plain characters, and it costs about as many tokens as plain text. Keep the PDF when charts or page layout matter. To get the Markdown, run the file through a PDF to Markdown for LLM converter and check the headings.

Illustration: four document cards for PDF, Markdown, JSON and a table, with an arrow into a chat bubble

Short answer: what is the best document format for ChatGPT?

The best document format for ChatGPT depends on what the document is. A quick guide:

Which format to give a chat model
Your contentGive the modelWhy
Reports, manuals, contracts, notesMarkdownStructure (headings, lists, tables) in plain characters
Prose with no structurePlain textSame cost as Markdown, nothing to lose
Charts, scans, forms, slidesThe PDF itselfThe model needs the page images
Rows of dataCSV or a spreadsheetOne record per line, easy to count and filter
Records for a program to useJSONExact fields and types, at a higher token cost

The rest of this guide explains the reasoning: what the model actually receives when you upload a PDF, what we measured when we counted tokens for the same documents in six formats, and how to prepare a file so the answer is grounded in the right section.

What happens when you upload a PDF

To choose the best document format for ChatGPT, start with what a PDF turns into. A PDF is a page description, not a text file. To read one, a model provider has to pull the text out, and the large providers also render the pages as pictures. OpenAI’s file inputs guide says that for PDFs on vision-capable models, the API extracts both the text and an image of each page and sends both to the model; other text files are sent as text only. Anthropic describes the same approach for Claude:

“The system converts each page of the document into an image. The text from each page is extracted and provided alongside each page’s image.”
Anthropic, PDF support, Claude documentation
Illustration: one PDF page split into extracted text lines and a page image, both sent into a chat bubble
An uploaded PDF reaches the model twice: as extracted text and as page images.

That is the core of markdown vs pdf for ai. The images help when the page has a chart or a scanned signature, and they cost extra: Anthropic’s page estimates 1,500 to 3,000 tokens per page for the text alone, before the images, and OpenAI warns that PDF inputs can raise token use. The extracted text is also only as good as the PDF’s text layer, so running headers, page numbers and broken tables arrive as they are. Both documents describe the developer APIs; the consumer chat apps do not publish the same level of detail.

Tokens: PDF vs Markdown and four other formats

To put numbers on tokens pdf vs markdown, we took four PDFs and turned each one into six text formats on 2026-10-19: our clean Markdown conversion, pdftotext plain text with and without layout, HTML rendered from the Markdown, and JSON with one object per block, pretty-printed and minified. We counted tokens with OpenAI’s tiktoken library (o200k_base encoding). We did not count the PDF path itself, because the page images are priced by each provider in its own way.

Tokens per format, in our tests (tiktoken 0.14.0, o200k_base)
DocumentMarkdownPlain textText, layout keptHTMLJSONJSON, minified
English guide, 5 pages2,6512,6672,7243,2374,0863,195
Chinese report, 11 pages8,6978,7138,8049,79611,0639,402
English report, 4 pages145217229246379225
Tables, 1 page10699102211265154
All four11,59911,69611,85913,49015,79312,976
Relative to Markdown1.00×1.01×1.02×1.16×1.36×1.12×
Markdown is our converter’s output in clean mode. The other formats were made from the same text, so the differences come from the format, plus the cleanup in the case of the 4-page report.

The honest reading: Markdown and plain text cost almost the same. Across all four files plain text was 1% larger, and on the one-page table file it was slightly smaller, because pipes cost tokens. The big gap on the 4-page report comes from cleanup, not syntax: plain text kept four copies of the running header and four page numbers. HTML cost 16% more than Markdown, pretty-printed JSON 36% more and minified JSON 12% more.

So Markdown is the best document format for ChatGPT not because it is tiny, but because the structure comes almost for free: plain text spends the same tokens and throws the headings and table columns away.

Why is markdown better for LLMs than JSON or HTML?

Asked plainly, why is markdown better for llms? Three reasons hold up. First, the structure is visible: a ## line is a section, a | row is a table, and a model has seen enormous amounts of both. Second, there is little noise: no closing tags, no quotes around every key, no escaped characters. Third, the provider guides lean the same way. OpenAI’s GPT-4.1 prompting guide suggests Markdown as the place to start for prompt structure, notes that JSON can be more verbose and needs character escaping, and reports that in its long-context tests JSON performed poorly as a container for many documents, while XML did well.

On json vs markdown for llm work, then: use JSON when a program will read the result or when the data is a list of records with fixed fields. Use Markdown for documents a model has to read and reason about. If you pass several documents at once, wrapping each Markdown file in a simple tag such as <document title="…"> gives you the separation XML offers without converting the content.

Screenshot: our converter turning a 5-page PDF guide into Markdown with headings, the best document format for ChatGPT to read
Screenshot: a 5-page guide converted to Markdown in the browser, headings intact.

How to prepare a document for ChatGPT

  1. Convert a text PDF to Markdown with cleanup on, so running headers and page numbers are gone. Our PDF to Markdown converter does this in the browser.
  2. Check the structure: one # title, ## for sections, tables as pipe tables. Fix any heading that came through as plain text.
  3. Split long files at headings, not at a fixed number of characters, so every chunk starts with its own title. This matters most for retrieval systems.
  4. Put the document first and the question last. Anthropic’s long-context tips recommend this order and report that it improved answers by up to 30 percent in their tests.
  5. Keep the PDF nearby for charts and figures, and upload it separately when a question is about a picture.
Illustration: a long Markdown document cut at each heading into separate chunks, each one starting with its title
Cut at headings, so each chunk carries its own title.

For pipelines rather than one-off chats, the Python route does the same conversion in code, and our local conversion guide covers keeping confidential files on your own machine until you choose to send them.

When the PDF is still the right choice

Markdown is not the best file format for chatgpt to read in every case. Keep the original when the meaning lives in the picture: charts and diagrams, scanned pages (Markdown from a scan is empty unless someone runs OCR), forms where position matters, and slides where layout is the message. In those cases the PDF itself is the best document format for ChatGPT: the page images the provider adds are exactly what you need, and the extra tokens are worth paying.

For a long report, the best document format for ChatGPT is often a mix: send the Markdown for the text, and the two or three pages with charts as a separate PDF or as images. You get the cheap, structured version for most questions and the visual version when it matters. Name the two files clearly, for example report.md and report-charts.pdf, and say in the prompt which one holds the figures, so the model knows where to look before it answers.

Sources

  1. File inputs (PDF files) — OpenAI API documentation
  2. GPT-4.1 Prompting Guide — OpenAI Cookbook, 2025
  3. PDF support — Anthropic, Claude documentation
  4. Long context prompting tips — Anthropic, Claude documentation
  5. tiktoken — OpenAI, GitHub

FAQ

What is the best document format for ChatGPT?

For text documents, Markdown: it keeps headings, lists and tables and costs about as many tokens as plain text. Use the PDF for charts and scans, CSV for data and JSON for records a program will read.

Is PDF or Markdown the best document format for ChatGPT?

Paste or upload Markdown when the content is text. A PDF is read as extracted text plus page images, which costs more tokens and keeps headers, footers and page numbers mixed into the text.

Does Markdown use fewer tokens than plain text?

Barely. In our tests the two were within about 1% across four files. Markdown came out smaller only where our converter removed running headers and page numbers.

Is JSON a good format for documents?

Not for reading. In our tests pretty-printed JSON cost 36% more tokens than Markdown, and OpenAI’s guide notes it performed poorly for long-context documents. Use it for structured records.

Can ChatGPT read scanned PDFs?

Models that see page images can read some scanned pages. A Markdown conversion of a scan is empty without OCR, so for scans, send the PDF or run OCR first.

Should I split a long document before sending it?

For chat, a single well-structured file is usually fine. For retrieval or when you hit context limits, split at headings so each part keeps its title.