How to convert a PDF to Markdown
Updated
Contents
To convert a PDF to Markdown, open PDF to Markdown, add your PDF, press Create Markdown, check the preview, and press Download MD. You get a UTF-8 .md file built from the text stored in the PDF.
A PDF stores positioned lines, not headings, paragraphs or lists, so the structure is worked out from the size and position of each line. It is usually close, rarely perfect: read the result before you publish it or paste it into a wiki.
The Markdown is made in your browser with pdf.js, so your PDF stays on your device and there is no account to create. It takes one PDF at a time, up to 100 MB, and there are no settings to choose.
Step by step
- 1Open the PDF to Markdown tool.
- 2Drop your PDF on the panel that says “Drop your PDF here, or browse”, or click it to choose the file. Its name, page count and size appear.
- 3Press Create Markdown. The button reads Creating Markdown… while every page's text is read and arranged.
- 4Under “Markdown created”, check the character and page counts and read the Markdown in the scrollable box. Select any part of it to copy just that passage.
- 5Press Download MD. report.pdf is saved as report-markdown.md. Start over clears the page for another document.
What structure you get
The file name, minus its extension, becomes the # title. In a PDF of more than one page, each page that has text gets its own ## Page heading with its page number.
Within a page, lines that wrap are joined back into sentences, and a word hyphenated at a line end is rejoined. A new paragraph starts where the gap between two lines is more than 1.3 times the spacing of a paragraph's wrapped lines, where a line is indented like a first line, or where the text moves back up the page to a new column without a sentence running on across it. A page with no wrapped line gives no spacing to measure and can arrive as one paragraph.
A short line set at least 20% larger than the body text becomes a heading, larger sizes ranking higher; one longer than 80 characters or ending in a full stop, comma or semicolon stays ordinary text. Lines that start with -, *, +, a number, or a bullet character such as • stay list items.
What is left out
Font weight and style are not read, so nothing comes out bold or italic. Images are dropped, and so are the web addresses behind links. A table's cells run together as plain words, without its grid.
For the tables themselves, Extract Tables detects them by where the words sit and returns CSV files and an Excel workbook, but it runs on our secure server rather than in your browser. For the text with its line breaks as they are and no Markdown added, PDF to Text reads the same text, also in your browser.
Characters that look like Markdown
Words are not rewritten. A paragraph that would otherwise read as Markdown syntax, such as one starting with # and a space, a rule like ---, a > quote or a | table row, gets a backslash in front so a Markdown viewer shows it as typed, and a < or & that would open an HTML tag or entity is escaped. Other asterisks, underscores and backticks pass through, so a Markdown viewer may format them.
Scanned PDFs and “No selectable text found”
A page with no stored text, such as a scan or a phone photo, adds nothing to the Markdown. When no page has any text, the result reads “No selectable text found” and no file is made.
OCR PDF can recognise the words and return a searchable PDF to bring back here; select every language printed on the pages. Unlike this tool, OCR PDF runs on our secure server rather than in your browser.
Common questions
Is my PDF sent anywhere when I convert it to Markdown?
No. The text is read in your browser tab and the .md file is made there too, so the PDF stays on your device from start to finish.
Are tables kept?
Not as Markdown tables. Their cells come through as plain words. Extract Tables returns tables as CSV and Excel files instead, on our secure server.
Why are my headings missing?
A line becomes a heading only when it is short and set at least 20% larger than the body text. A heading in the body size, made bold instead of larger, stays ordinary text, because font weight is not read.
How is this different from PDF to Text?
Both read the same text in your browser. PDF to Text writes a plain .txt file with the PDF's line breaks and no markers; PDF to Markdown joins lines into paragraphs, turns larger type into headings, keeps list lines apart and adds the title and page headings.
Can it convert a password-protected PDF?
Not one that needs a password to open: it is refused as it opens. Unlock PDF removes that password if you know it, but it runs on our secure server. A PDF that opens without a password and only restricts copying or printing converts like any other.