Guide · 8 min read

How to Convert PDF to Markdown for ChatGPT and Claude

ChatGPT's built-in PDF upload is convenient, but pasting clean Markdown gives you more control and better results. Here is how to convert your PDF, what to clean up, and how to structure the prompt.

Published April 17, 2026 · Updated April 17, 2026

Editorial details

Written by

any2markdown Editorial Team

Reviewed against

Current any2markdown output

Method

Hands-on conversion tests and published source docs

This guide is maintained alongside the live MarkItDown-backed workflow on any2markdown.com. Where a guide compares tools or workflows, the links in the references section point to the original project documentation or repositories.

Why convert PDF to Markdown before using ChatGPT or Claude

ChatGPT and Claude both accept PDF attachments directly, but the internal text extraction they apply is not always reliable — particularly for scanned documents, multi-column layouts, or PDFs with complex table structures. When you convert a PDF to Markdown first and paste that text into the conversation, you have full visibility into what the model is actually receiving. You can trim noise before it reaches the model, and you stay within the context window more efficiently.

Both models were trained on enormous amounts of Markdown-formatted text. When you feed clean Markdown, you are providing input in a format the model reasons about fluently: headings signal document structure, bullets indicate list items, code blocks are treated as preformatted content. The model's ability to accurately summarize, extract, and reason about your document improves when the structure is explicit.

There is also a practical control advantage. When you paste Markdown, you can see and edit exactly what goes to the model. When you attach a PDF, you cannot inspect how the model extracted the text or remove boilerplate before it influences the response.

Native PDFs versus scanned PDFs

The single most important distinction in PDF-to-Markdown conversion is whether the PDF contains selectable text (native) or was created by scanning a physical document (image-based). This determines how cleanly the conversion will go.

Native PDFs — created by exporting from Word, Google Docs, LaTeX, or most modern applications — contain actual text metadata that can be extracted directly. Conversion is fast, accurate, and rarely requires heavy cleanup. MarkItDown handles native PDFs via pdfminer, which is well-suited to direct text extraction from PDFs that were generated programmatically.

Scanned PDFs are images wrapped in a PDF container. Converting these requires optical character recognition (OCR). OCR accuracy depends on scan quality, font clarity, page resolution, and layout complexity. Multi-column academic papers, invoices with irregular layouts, and handwritten inserts all produce variable results. For scanned PDFs, always review the Markdown output before sending it to a model — a misread number or missed section header can cause confident-sounding but incorrect model responses.

Token efficiency and context window planning

Both GPT-4o and Claude Sonnet have large context windows, but effective use of that space still matters — especially when you are combining multiple documents, long system prompts, and conversation history in a single session.

A well-converted Markdown document from a 20-page text-dense PDF typically produces between 3,000 and 8,000 tokens depending on content density. That leaves room for a substantive system prompt, several rounds of conversation, and additional reference material if needed. A poorly extracted version of the same document — with repeated headers, footer text on every page, and table of contents lines scattered throughout — can easily double the token count with no additional useful information.

If you are feeding multiple PDFs to a model for cross-document analysis, converting each to Markdown and trimming boilerplate before sending can significantly reduce total token consumption while improving the model's ability to reason across documents simultaneously.

Step-by-step workflow

Upload your PDF to the converter. The tool will extract text and structure it as Markdown. Review the preview — check that headings are correctly identified, tables render as Markdown table syntax, and section structure matches what you expected from the source document.

If the document had multiple columns, the reading order may need light reordering in sections where columns were merged into a single reading flow. Look for places where text from adjacent columns appears interleaved in the output and reorganize manually if needed.

Copy the Markdown. Open a ChatGPT or Claude conversation. You can paste the Markdown directly into the message for smaller documents, or save it as a .md file and attach it. Begin your prompt with the analysis task — summarize this, extract all dates, identify the key risks — and the model will parse the Markdown structure in its response.

Common pitfalls and how to avoid them

Boilerplate pollution is the most common issue. Headers, footers, and page numbers repeated throughout a paginated document appear as repeated text in the Markdown output. Before sending to the model, do a quick search for patterns that repeat — page numbers, document title headers, footer text — and delete them. This is especially important for regulatory or legal PDFs where boilerplate is dense.

Table flattening is the second most common issue. If the source PDF had complex tables with merged cells or multi-row headers, the Markdown output may represent them as a sequence of list items or prose rather than proper Markdown table syntax. For tables that the model needs to reason about — financial data, comparative specifications, tracking matrices — manually restructuring the Markdown table is usually worth the effort.

Mixed-quality content in hybrid PDFs can confuse model reasoning. Some PDFs combine native text sections with scanned image inserts. The native sections convert cleanly; the scanned sections produce variable quality. When you send a hybrid document, it helps to note in your prompt where you expect OCR uncertainty, so the model can flag responses where it is drawing on lower-confidence text.

Convert your PDF to Markdown

Upload a PDF and get clean Markdown output in seconds, ready to paste into ChatGPT or Claude.

Convert now

Frequently asked questions

Can I paste a full 50-page PDF into ChatGPT as Markdown?

Yes, if the Markdown output falls within the context window. A 50-page text-dense PDF might produce 15,000 to 25,000 tokens, which is within GPT-4o's context. For longer documents, splitting by chapter or major section and querying each part separately produces better results.

Is it better to attach the PDF file or paste the Markdown?

Pasting Markdown gives you visibility into what the model is receiving and lets you trim noise before it affects the response. Direct PDF attachment is more convenient but gives you less control over extraction quality, especially for scanned documents or complex layouts.

Does this work for academic papers with equations?

Text and citations convert well. Mathematical formulas using LaTeX notation may convert to text fragments rather than proper LaTeX syntax. For equation-heavy content, review and repair the math notation manually before submitting, or note the uncertainty in your prompt.

What about PDFs with embedded images?

The text surrounding images converts normally. Embedded images themselves are not automatically converted to text descriptions — image content needs to be handled separately with a vision-capable model if the image content is important.

Does this also work for Claude?

Yes. Claude processes Markdown input in the same way. The workflow is identical: convert the PDF, clean up the Markdown, paste or attach the file. Claude has strong Markdown comprehension and handles well-structured Markdown input reliably.

References

Related