# Document to Markdown: Converting PDFs and Office Files for LLMs

> How to convert PDFs, scans, Word docs, slides, and spreadsheets into clean Markdown and HTML tables for RAG and LLM pipelines without losing structure.

Canonical: https://reducto.ai/guides/document-to-markdown

## The short answer

Converting a document to Markdown for an LLM or RAG pipeline is not just text extraction. Plain text extractors strip heading hierarchy, scramble multi-column reading order, and flatten complex tables into unreadable rows. A layout-aware parser reads the full page first, recovers headings, lists, reading order, and formatting, and outputs structured chunks with page-relative bounding boxes.

Reducto's [Parse API](https://docs.reducto.ai/parse/overview) converts PDFs, scanned images, Word files (DOCX, DOC, DOTX, RTF), PowerPoint decks (PPTX, PPT), and spreadsheets into LLM-ready Markdown and HTML tables in a single pass using [r-1 and r-1 mini](https://docs.reducto.ai/parse/r-1). You can test single files immediately with the free [PDF to Markdown tool](https://reducto.ai/tools/pdf-to-markdown) or automate high-volume pipelines via API starting at $1 per 1,000 pages with `r-1 mini` ($0.80 per 1,000 pages with the batch queue discount).

## Why Markdown works for LLMs, and where it breaks

Markdown has become the default intermediate format for retrieval-augmented generation and coding or research agents because it preserves document semantics (headings, nested lists, emphasis, simple tables) with low token overhead.

However, pure Markdown has three well-known failure modes on real enterprise documents:

- **Merged and nested table cells**: GitHub-flavored Markdown tables have no syntax for `rowspan` or `colspan`. Financial statements, regulatory filings, and spec sheets with grouped headers lose column alignment when forced into pipe-delimited Markdown.
- **Multi-column layouts and sidebars**: rule-based PDF-to-Markdown libraries often read horizontally across columns instead of following visual reading order, interleaving unrelated sentences.
- **Charts, figures, and visual annotations**: strikethroughs, highlights, signatures, and embedded charts disappear in text-only converters, even though they often carry the exact decision or revision the model needs.

## Choosing the right table format: `dynamic`, `html`, or `md`

When converting documents to Markdown, table formatting is the single biggest lever on downstream LLM accuracy. Reducto's [Table Output Formats](https://docs.reducto.ai/configs/parse/table-output-formats) give you direct control per request:

<Table html={"<div style=\"overflow-x: auto;\">\n<table><thead><tr><th scope=\"col\">Format</th><th scope=\"col\">How it behaves</th><th scope=\"col\">Best for</th></tr></thead><tbody><tr><td><code>dynamic</code></td><td>Uses Markdown for simple tables (30 cells or fewer and 4 merged cells or fewer) and HTML for complex tables (over 30 cells or over 4 merged cells)</td><td>General RAG pipelines balancing readability and structural accuracy</td></tr><tr><td><code>html</code> (r-1 default)</td><td>Full HTML table structure with explicit <code>rowspan</code> and <code>colspan</code> attributes</td><td>Financial statements, regulatory filings, and any table where merged headers carry meaning</td></tr><tr><td><code>md</code></td><td>GitHub-flavored Markdown pipe tables throughout</td><td>Lightweight text corpora with flat, unmerged tables</td></tr><tr><td><code>json</code> / <code>csv</code></td><td>Structured row/cell representations for programmatic consumption</td><td>Downstream analytics or tabular ingestion outside prose chunks</td></tr></tbody></table>\n</div>"} />

For most RAG systems, keeping HTML tables (the `r-1` default) or using `dynamic` avoids silent row/column corruption on complex tables while keeping prose clean in Markdown.

## Handling PDFs, Office files, and spreadsheets in one pipeline

Enterprise knowledge bases rarely contain only PDFs. Reducto's [Upload endpoint](https://docs.reducto.ai/upload/overview) accepts PDFs, images, Word documents, PowerPoint presentations, and spreadsheets through the same API flow (up to 100MB via standard upload or up to 5GB via [presigned URLs](https://docs.reducto.ai/upload/large-files)).

- **PDFs and scans**: `r-1` reads digital text, scans, handwriting, and mixed formatting in one full-page pass, resolving columns, headers, footers, and sidebars together.
- **Word and PowerPoint**: formatting such as headings, bold text, underlines, strikethroughs, comments, and change tracking can be preserved (see [Additional Document Data](https://docs.reducto.ai/configs/parse/additional-document-data)). Figures receive a short native description automatically, and [Chart Extraction](https://docs.reducto.ai/configs/parse/chart-extraction) can extract underlying data from dense charts.
- **Spreadsheets**: [Spreadsheet Processing](https://docs.reducto.ai/configs/parse/spreadsheet) converts cells to pages using configurable clustering modes (`accurate` at 1,000 cells per page; `fast` or `disabled` at 5,000 cells per page). Note from [Usage and Pricing](https://docs.reducto.ai/reference/credit-usage) that `r-1 mini` does not process spreadsheets, so route Excel and CSV files to `r-1`.

## Chunking Markdown output for RAG and embeddings

Raw full-document Markdown still needs to be split into retrieval units before embedding. Splitting on naive character counts slices through tables and separates headings from the paragraphs they introduce.

Reducto's [Chunking Methods](https://docs.reducto.ai/configs/parse/chunking-methods) group parsed blocks natively before returning the response:

- **`variable` (recommended for RAG)**: targets a character size (default 750 to 1,250 characters, or ±25% around a custom `chunk_size`), starts new groups at headers, splits oversized groups at physical page boundaries, and keeps headers with their content, figures with captions, and list items together.
- **`section` or `page` modes**: useful when retrieval must align strictly to document sections or physical page boundaries.
- **Block metadata and bounding boxes**: every chunk includes its constituent blocks with block type, page position, and bounding box so your RAG UI can link an LLM answer back to the exact source region.

For a deeper comparison of RAG parsing tools, see [Best Document Parsers for RAG](https://reducto.ai/guides/best-document-parsers-rag).

## Cost and accuracy tradeoffs: `r-1` vs. `r-1 mini`

In [ParseArena](https://reducto.ai/blog/reducto-r-1-mini-parse-model), Reducto's evaluation of 22 parser configurations on 2,000 public-document pages across seven industries scored by a blind [PAIR](https://reducto.ai/blog/pairwise-ai-ranking-parse-evaluation) judge, full-layout parsing beat OCR-only APIs and self-hosted open models on structural fidelity:

<Table html={"<div style=\"overflow-x: auto;\">\n<table><thead><tr><th scope=\"col\">Configuration</th><th scope=\"col\">List price / 1,000 pages</th><th scope=\"col\">Batch queue price</th><th scope=\"col\">Pages with no serious error (ParseArena)</th><th scope=\"col\">Median latency</th></tr></thead><tbody><tr><td><a href=\"https://docs.reducto.ai/parse/r-1\">Reducto r-1</a></td><td>$10</td><td>$8 (20% batch discount)</td><td>76.3%</td><td>3.00 s</td></tr><tr><td><a href=\"https://docs.reducto.ai/parse/r-1\">Reducto r-1 mini</a></td><td>$1</td><td>$0.80 (20% batch discount)</td><td>65.7%</td><td>3.80 s</td></tr><tr><td>Google Enterprise Document OCR</td><td>$1.50</td><td>N/A</td><td>24.1%</td><td>2.02 s</td></tr><tr><td>Amazon Textract Detect Document Text</td><td>$1.50</td><td>N/A</td><td>24.5%</td><td>3.59 s</td></tr></tbody></table>\n</div>"} />

Choose `r-1` when you need the highest accuracy on dense charts, degraded scans, spreadsheets, or lower latency for synchronous user flows (with word-level [Parse citations](https://docs.reducto.ai/configs/parse/citations) included at no extra charge). Choose `r-1 mini` for large, cost-sensitive PDF archives, web crawls, and bulk knowledge-base ingestion, and use the [Batch Queue](https://docs.reducto.ai/workflows/batch-queue) for non-urgent jobs (12-hour completion guarantee, 20% discount).

Because every corpus has its own edge cases, benchmark candidate converters on a sample of your own files with [ParseJudge](https://parsejudge.com/), or compare cloud alternatives in [Reducto vs LlamaParse](https://reducto.ai/compare/reducto-vs-llamaparse) and [Reducto vs Unstructured](https://reducto.ai/compare/reducto-vs-unstructured).

## Frequently asked questions

### Should I convert complex PDF tables to Markdown or HTML for RAG?

Use HTML (`table_output_format: "html"` or `"dynamic"`) whenever tables contain merged cells or nested headers. Markdown cannot encode `rowspan` or `colspan`, so forcing complex financial or technical tables into Markdown drops column relationships before the LLM ever sees them.

### Can I convert documents to Markdown without writing code first?

Yes. You can upload a PDF directly in the free [PDF to Markdown tool](https://reducto.ai/tools/pdf-to-markdown) or build and inspect a [Parse Pipeline](https://docs.reducto.ai/studio-parse) inside [Reducto Studio](https://studio.reducto.ai) with $150 in free standard-account credits.

### How do I keep citations back to the original PDF when converting to Markdown?

Every parsed block includes page-relative bounding boxes by default. When you need word-level highlighting or table-cell boxes, enable [Parse citations](https://docs.reducto.ai/configs/parse/citations) (`return_citations: true`), which is included with `r-1` and available as a $1 per 1,000 pages add-on with `r-1 mini`.

### Does `r-1 mini` support Excel and CSV files?

No. Per [Usage and Pricing](https://docs.reducto.ai/reference/credit-usage), `r-1 mini` does not process spreadsheets. Route `.xlsx` and `.csv` files to `r-1` with Reducto's [Spreadsheet Processing](https://docs.reducto.ai/configs/parse/spreadsheet) options.
