How to Convert PDF to Text (5 Free Ways That Actually Work)
Converting a PDF to text takes about ten seconds, or it cannot be done at all. Which one you get depends on something the PDF does not show you: whether it has a text layer.
A PDF made by a word processor, a website or an invoicing system stores the actual characters, so any tool can read them straight out. A PDF made by a scanner or a phone camera stores a picture of a page. It looks exactly the same on screen, and it contains no text whatsoever. We confirmed how stark the difference is: our scanned test invoice returned 0 characters from a standard extractor, and the same page as a digital PDF returned all of them.
This guide covers five free ways to get plain text out of a PDF, which one to use for which kind of file, and the four things that scramble the output even when extraction "works". Every claim below comes from running six test PDFs through the tools, not from a spec sheet.
First, check whether your PDF has a text layer
Open the PDF in any viewer and try to highlight a single word with your cursor.
- The word highlights on its own: the PDF has a text layer. Use Method 1, 2 or 4. They are fast and copy the characters exactly.
- Nothing highlights, or a whole-page box appears: the page is an image. Only OCR (Method 3) or Google Docs (Method 5) can read it.
This matters because a text extractor pointed at a scan does not fail loudly. When we ran our scanned invoice through an extractor that reads the text layer, it returned an empty page with a success message. If your "converted" text file is blank, you have a scan, not a broken tool.
Method 1: Copy and paste (any PDF with a text layer)
For a short document you only need once, the tools you already have are enough.
- Open the PDF in your browser, Adobe Acrobat Reader, or Preview on a Mac.
- Press Ctrl+A (⌘+A on Mac) to select all the text on the page or document, then Ctrl+C to copy.
- Open a plain-text editor: Notepad on Windows, or TextEdit on Mac after choosing Format → Make Plain Text.
- Paste, then save the file with a
.txtextension, using UTF-8 encoding if you are asked.
Pasting into a plain-text editor first matters. Paste straight into Word or Google Docs and you carry the PDF's fonts and odd spacing with you. A plain-text editor strips all of that, so you see exactly what came out.
The catch is that copy-paste gives you whatever order the PDF stores the text in, which is not always the order you read it. That is covered in what goes wrong below.
Method 2: Extract the text layer in your browser
For long documents, or when you want a file rather than a clipboard, the FileNaut PDF to Markdown converter pulls the whole text layer out at once. It runs entirely in your browser, so the PDF is never uploaded. Markdown is plain text with a few symbols added, so the result opens in any text editor.
- Open PDF to Markdown and drop in your PDF.
- Click Extract Text. The text appears in the right-hand panel almost instantly.
- Click Download .md, then rename the file from
.mdto.txt, or copy the text straight from the panel. - Delete the
## Page 1headers and---dividers the tool adds between pages if you do not want them.
What it does well: the characters are copied exactly, with no recognition errors, and simple tables came out one row per line (Apples 12 $4.50) in our test.
One limitation you should know about. In our testing, lines set very close together, such as 10-point text at single spacing, were joined with no space between them: "ten points." followed by "Tight line two" came out as points.Tight line two. Lines with normal or generous spacing were fine. If you see words glued together at line ends, run the same file through Method 3 instead, which reads the page visually and got those lines right.
Method 3: OCR for scanned PDFs (and any PDF that comes out garbled)
OCR (optical character recognition) reads the text off a picture of the page, the same way you do. It is the only way to get text from a scanned PDF, and it is also a good fallback when a digital PDF's text layer is damaged. Our guide to OCR explains how it works.
- Open FileNaut PDF OCR and drop in your PDF.
- Click Extract Text. Each page is rendered and read in your browser, and the progress bar counts through the pages.
- Click Copy and paste into a plain-text editor, then save as
.txt. There is also a Word button if you want a document instead.
How well it did in our tests:
- The scanned invoice came back word-perfect, including the figure
$1,284.50, where the text-layer extractor returned nothing. - A 10-page, 300-line document was read with all 300 lines exactly right, in about 11 seconds on a laptop, so roughly one second per page.
- It correctly separated the tightly spaced lines that Method 2 joined together.
OCR accuracy depends on the scan. Clean, straight, 300 DPI pages of printed text read almost perfectly. Handwriting, faint photocopies, skewed phone photos and decorative fonts will produce errors, so proofread anything that matters, especially numbers.
For a single image rather than a PDF, such as a screenshot, use Image OCR.
Method 4: Command line and Python (for batches)
If you have hundreds of PDFs, do it with a script. Two standard options:
pdftotext is part of the free Poppler toolkit (brew install poppler on Mac, sudo apt install poppler-utils on Debian or Ubuntu):
pdftotext input.pdf output.txt
pdftotext -layout input.pdf output.txtThe -layout option keeps text in its physical position, so columns and tables stay side by side instead of being read into one stream.
Python with pypdf (pip install pypdf). We ran this exact script on our 10-page test file and got all 10 pages, 320 lines, into output.txt:
from pypdf import PdfReader
reader = PdfReader("input.pdf")
with open("output.txt", "w", encoding="utf-8") as f:
for page in reader.pages:
f.write((page.extract_text() or "") + "\n")pypdf has a layout mode as well: page.extract_text(extraction_mode="layout"). On our test table it produced properly aligned columns (Item … Qty … Price) where the default mode put every cell on its own line.
Neither tool does OCR. On a scanned PDF, both give you an empty file.
Method 5: Microsoft Word or Google Docs
If you already live in Word or Google Docs, both can open a PDF and save it as plain text.
- Word (Windows or Mac): use File → Open and choose the PDF. Word converts it into an editable document, then File → Save As and choose Plain Text (.txt). The conversion is aimed at keeping the layout, so expect some odd line breaks.
- Google Docs: upload the PDF to Google Drive, right-click it and choose Open with → Google Docs. Google runs OCR as part of the conversion, so this also works on many scans. Then use File → Download → Plain text (.txt).
Both routes upload your file to a cloud service or run a full office suite. For a confidential document, Methods 2 and 3 keep everything on your own machine. If what you actually need is an editable document rather than raw text, PDF to Word and our PDF to Word guide are the better fit.
What goes wrong (and what to do about it)
A successful conversion can still give you text in the wrong order or with pieces joined together. We built one test PDF for each problem and ran it through the tools. Here is what happened:
| Problem | What we measured | What to do |
|---|---|---|
| Scanned page | 0 characters from text-layer extraction; word-perfect from OCR | Use PDF OCR |
| Two columns, stored row by row | Every method, OCR included, read straight across: left line 1, right line 1, left line 2… | Crop to one column at a time, or use a layout mode and cut the columns apart |
| Two columns, stored column by column | Read correctly: the whole left column, then the whole right | Nothing. How the PDF was made decides this, not your tool |
| Tables | Default pypdf put each cell on its own line; the browser extractor and OCR kept one row per line | Use layout mode, or get the data as a CSV from the source |
| Tightly spaced lines | One extractor joined 10pt single-spaced lines with no space; OCR did not | Scan the output for glued words at line ends; switch to OCR if you find them |
| Hyphenated line breaks | "hyphen-" and "ated" came out as hyphen- / ated or hyphen-ated, never repaired | Find-and-replace - followed by a line break |
The pattern: a text extractor reports what the file stores, in the order it stores it. A PDF records where each piece of text goes on the page. It does not record which piece a person should read next. When the storage order and the reading order match, the output is clean. When they do not, no text-layer tool can know.
Tips for cleaner text
- Spot-check the end of every page. Problems gather at page breaks: headers, footers and page numbers get mixed into the text.
- Search the output for a phrase you can see in the PDF. If it is missing, you have either a scan or a font that does not map to real characters. Switch to OCR.
- Save as UTF-8. Otherwise accented letters, curly quotes and symbols can turn into question marks.
- Compare two methods when accuracy matters. Paste the two outputs into Text Compare and every disagreement is highlighted. That is usually where one method went wrong.
- Check the length. The Word Counter tells you straight away if the output is far shorter than the document looks.
- Want headings and lists as well? Plain text drops all structure. Our PDF to Markdown guide covers keeping it.
Frequently asked questions
Why can't I copy text from my PDF? ▼
Does a "no copying" permission actually stop text extraction? ▼
How do I convert a scanned PDF to text? ▼
Why does my converted text have the columns mixed together? ▼
Is it safe to convert a confidential PDF online? ▼
What is the difference between PDF to text and PDF to Word? ▼
.txt file holds only characters. It has no fonts, images, tables or layout, which is what you want for searching, pasting into another system, or feeding a script. A Word document tries to rebuild how the page looked. If you plan to edit the document and keep its appearance, use PDF to Word.Why are there strange characters or question marks in my text? ▼
How long does OCR take? ▼
The short version
Try to highlight a word first. If it highlights, the PDF has a text layer: copy and paste into a plain-text editor, or pull the whole file out with PDF to Markdown and save it as .txt. If nothing highlights, it is a scan, and PDF OCR is the tool.
Then check the output before you trust it. Columns stored row by row, tightly spaced lines and hyphenated line breaks are where every method goes wrong, and none of them fail with an error.
Ready to try it?
Use the tool right now — free, no signup, no upload.