PDF to Markdown: how it works and what it preserves

A PDF stores glyphs at coordinates. It does not store a heading, a list, or a table, so everything structural has to be inferred back out of that geometry. This page explains how that inference works, what survives it, and the documents where it fails.

Drop your PDF or Word file here

or choose a file from your computer

PDF or Word (.docx) · up to 50 MB

How does a converter turn a PDF back into headings and lists?

It measures the most common font height in the document, treats that as the body text baseline, and classifies everything relative to it. Larger runs become headings; bullet glyphs and indent depth become nested lists.

What does PDF to Markdown conversion lose?

Merged table cells, images, annotations and page furniture have no Markdown equivalent. A scan contains no selectable text at all, so it needs the separate scanned PDF converter, which recognises the words on our server.

How to convert a PDF to Markdown

  1. 1

    Open the converter

    Go to mypdf2md.com. Nothing to install and no account to create.

  2. 2

    Add your PDF

    Drag the file onto the drop zone, or click to pick it from your computer. Files up to 50 MB are accepted.

  3. 3

    Review the Markdown

    The converted Markdown appears alongside a live preview. Edit it directly if a heading or table needs a nudge.

  4. 4

    Copy or download

    Copy the Markdown to your clipboard, or download it as a .md file ready for your editor or repository.

What the converter reconstructs

A PDF does not store a heading, a list, or a table. It stores glyphs at coordinates on a page. Everything structural has to be inferred back out of that geometry, which is why so many PDF-to-text tools return an undifferentiated wall of text. What a PDF records and what it throws away is the long version, and it explains every error below.

This converter measures the most common font height in your document and treats it as the body text baseline, then classifies everything relative to it.

Tables are the block that most often comes back wrong, and the failure is diagnosable from the output: merged cells, a cell whose text wrapped, and a table spanning a page break each leave their own recognisable signature.

  • Headings, from font size relative to body text, mapped to H1 through H4
  • Paragraphs, by merging lines whose vertical gap is small enough to be line spacing rather than a break
  • Bulleted and numbered lists, including nesting inferred from indent depth
  • Tables, where cells align on the same columns across consecutive rows, rendered as GFM pipe tables
  • Bold, italic and monospace runs, from the font each glyph is set in
  • Two-column layouts, read left column fully before right, rather than interleaved line by line

What it cannot do

Scanned documents contain no selectable text, only an image of text. This converter reads a PDF's text layer, so faced with a scan it correctly finds nothing — and it tells you so rather than handing back an empty file. Recognising the words inside the image is a different job, done by the scanned PDF converter: a separate tool that sends the pages to our own server, and only when you ask it to.

Heavily designed layouts — magazine spreads, infographics, pages with text flowing around images at odd angles — will lose some of their reading order. Two-column academic papers are the borderline case, and the gutter test that decides them has a short list of layouts that beat it. Straightforward documents like reports, papers, invoices, manuals and ebooks convert well — though anything thesis-length is better taken apart before it is converted.

Images inside the PDF are not extracted. The text around them is.

Why in-browser conversion matters

Most online converters upload your file to their servers, process it there, and hand back a download link. That means your document sat on someone else's disk, however briefly, governed by a privacy policy you did not read. How seven PDF-to-Markdown tools compare sets out which ones do that and which run locally, from each tool's own documentation.

This tool never makes that request. The PDF is parsed by PDF.js running in a Web Worker on your own machine. You can verify it: open your browser's network tab during a conversion and you will see no upload. Even the PDF.js worker files are served from this domain rather than a third-party CDN, so no outside party learns that you converted anything at all. The full pipeline, step by step, sets out what each stage does and where it stops working.

One document, converted

Everything above describes the inference. This is one run of it: the first two pages of the sample document on this site, put through the same code that runs when you drop a file on the box above. The third page is a two-column discussion, left out here only for length.

You can reproduce it in a click — “Or try a sample PDF” under the drop zone loads this exact file. The Markdown below is not retyped or tidied up; it is the converter's output, pasted, and a test fails our build if the two ever stop matching.

What the PDF pages contain

  • A 24pt title, two 17pt section headings and three 14pt subheadings, all of which the converter has to recognise by measuring them against the 11pt body text
  • Four paragraphs, each wrapped across two to four lines with no paragraph mark of any kind in the file — only a vertical gap wider than the line spacing
  • A four-item bulleted list whose third item is indented eighteen points further than the others
  • A three-step numbered list
  • A measurements table, four columns by five rows, on the second page — held together by nothing but the horizontal positions its cells share
The Markdown it produces
# Riverside Field Survey

This document is a sample used to demonstrate PDF to Markdown conversion. It contains the structures that matter: headings at several levels, paragraphs that wrap across lines, bulleted and numbered lists, a table of measurements, and a two-column section near the end.

## Method

Readings were taken at four stations along a two kilometre stretch of river, once in the morning and once after dusk. Each station was sampled three times and the median value recorded.

### Equipment

- Handheld conductivity meter, calibrated weekly
- Digital thermometer with a one metre probe
  - Spare probe, used only at station three
- Field notebook and waterproof pen

### Procedure

1. Rinse the probe in river water before the first reading of each station.
2. Wait for the display to settle, then record the value to one decimal place.
3. Repeat twice more, moving one metre upstream between readings.

Note: readings at station four were taken after heavy rain and are flagged as provisional in the table overleaf.

## Measurements

| Station | Temperature | Conductivity | Status |
| --- | --- | --- | --- |
| One | 11.4 C | 310 uS/cm | Normal |
| Two | 11.9 C | 298 uS/cm | Normal |
| Three | 12.6 C | 455 uS/cm | Elevated |
| Four | 12.1 C | 402 uS/cm | Provisional |

### Next steps

A further round is scheduled for the same four stations. No change to the method is proposed.

One thing is missing from that output, and it is worth naming: none of it is bold or italic. The title and the table's header row really are set in Helvetica-Bold in the source file. The converter never learns that, because emphasis is read from the font's name and pulling text out of a PDF does not hand over font names — each run arrives tagged with an internal identifier and one generic family, “sans-serif”, whether it was set bold or not. The real name only becomes available when a page is drawn to the screen, which converting never does. Monospace is the exception that survives, since “monospace” is one of the families that does come through. What a PDF records and what it throws away covers the wider version of this problem.

Frequently asked questions

How are two-column layouts handled?
The left column is read in full before the right, rather than interleaving the two line by line as a plain text extraction would.
Why did my table come out as paragraphs?
Detection requires cells to align on the same columns across consecutive rows. Where a table's structure comes from drawn rectangles rather than text alignment, it stays as paragraphs — deliberately, since a wrong table is harder to clean up than plain text.
Are repeated page headers and footers removed?
Yes. Text that repeats at the same position across several pages is treated as page furniture and dropped, so it does not interrupt the document body.
Can it handle password-protected PDFs?
Yes. You will be prompted for the password, which is passed straight to the local parser and never transmitted or stored.
What happens to very large PDFs?
Files above 50 MB are rejected before parsing starts, and any single conversion running longer than 60 seconds is stopped so the browser tab stays responsive.

Related converters

Further reading