📝

PDF to Text

Extract text from a PDF into a plain .txt file you can copy, search or edit.

Your files stay on this device. Nothing is uploaded. How to check

Advertisement

How to use PDF to Text

1. Drop your PDF on the upload box or click Choose Files. Extraction starts as soon as the file is chosen; there are no options to set.
2. The text of every page is read with pdf.js and joined into one plain-text file, with a marker line before each page.
3. Click Download File to save the .txt, edit the text in the box under the result, or click Copy to Clipboard to paste it somewhere else.

Key features of PDF to Text

📝 Plain .txt output

The download is a UTF-8 text file named after your PDF. Each page is introduced by a marker line, so you can find the page breaks in a long document.

✏️ Edit and copy on the page

The extracted text appears in an editable box under the result. Tidy it there and use Copy to Clipboard; the download button still saves the original extraction.

🖥️ Nothing is uploaded

The PDF is read by JavaScript in your browser. Nothing is sent to a server, and there is no account or watermark.

About PDF to Text

PDF to Text reads each page with pdf.js and joins the text runs on it with spaces. Line breaks inside a page are not reconstructed, so each page comes out as one run of text under a marker line naming the page. The result is offered as a .txt download and shown in an editable box with a copy button.

Use it to search a long document, feed the words into another program, or paste a passage into notes or an email without retyping it. Formatting, images and tables are not kept, and the reading order of multi-column pages may not be. A scanned PDF has no text layer, so the file comes out with only the page markers; run it through OCR PDF first.

When to use PDF to Text

A journal or a competition sets a word limit and you have only the PDF. Extract the text, paste it from the box into a word counter, and you have the figure without retyping. The marker lines are counted too, so remove them first if the count must be exact.

You need to translate a document with an online translator that takes pasted text. Extract it, copy a page at a time from the box, and use the marker lines to keep your place. The output is UTF-8, so accented characters and non-Latin scripts survive when the PDF's fonts carry their Unicode values.

A list of email addresses, part numbers or URLs is trapped in a PDF and you want it in a spreadsheet. Because this tool joins everything with spaces, a table comes out as one run per page; PDF to Excel keeps the columns and is the better pick for that. For a document whose headings and paragraphs you need kept, use PDF to Word or PDF to Markdown.

To find what changed between two versions of a document, do not extract both and compare them by hand: Compare PDF does a word-level comparison of the two files directly. And for a scan, run OCR PDF first, then extract; the OCR layer is what this tool reads.

Tips and troubleshooting

  • Failed to extract text: No password given means the PDF needs a password to open. There is no password field here; remove the protection and extract from the copy. Copy and print restrictions do not stop extraction.
  • Failed to extract text: Invalid PDF structure means the dropped file is not a PDF. Drag and drop accepts any file, unlike the picker.
  • Each page begins with a line reading --- Page N ---. Remove those lines with find and replace if you do not want them in the text.
  • You may see doubled spaces where lines ended in the PDF, because pdf.js reports a line end as an empty run and every run is joined with a space. A find and replace of two spaces with one cleans them up.
  • Wrong or missing characters mean the PDF's font has no Unicode mapping for them; the tool writes what the file contains. Running the PDF through OCR PDF recognises the words from the rendered page instead.
  • The box under the result shows eight lines at a time. Drag its bottom corner to make it taller, or scroll inside it.
  • Preview Document shows the same text in a frame. The download is UTF-8 with Unix line endings and takes the PDF's name with a .txt extension. Process Another File reloads the page, which discards any edits in the box, so copy or download first.
  • Plain text has no headings. PDF to HTML reads the same text layer and marks some short lines as headings in a standalone HTML file.
  • An output with nothing but the --- Page N --- lines means the PDF is a scan. How to make a scanned PDF searchable starts with a quick check for that and shows how to add the text layer this tool reads.

How PDF to Text works in your browser

The script reads the file into an ArrayBuffer and hands it to pdf.js, whose worker (from cdnjs.cloudflare.com) parses the document. For each page it calls getTextContent, which returns the text runs in the order the page's content stream draws them, and joins their strings with single spaces behind a marker line naming the page. The pages are concatenated into one string, which becomes a Blob of type text/plain with UTF-8 encoding. Only pdf.js is loaded on this page; no ZIP library is needed.

showResult draws the result card from that Blob, and the script then appends a textarea containing the same text and a Copy to Clipboard button that writes the box's current contents with the browser's clipboard API; the button reads Copied for two seconds. Download File saves the original string through a temporary object URL, and Preview Document loads it into a frame. The PDF bytes and the text stay in the tab's memory and are never sent anywhere.

Frequently asked questions

Why does each page come out as a single long line?

The tool joins the text runs on a page with spaces and does not reconstruct line breaks. Paragraphs and columns are not detected. For structured output, use PDF to Word or PDF to Markdown.

Can it extract text from a scanned PDF?

Not on its own. A scan is an image with no text layer, so the output contains only the page markers. Run the file through OCR PDF first, then extract the text.

Is the downloaded file the same as the text in the box?

The download is the original extraction. Edits you make in the box are not written to the file; use Copy to Clipboard to take the edited version.

How do I know which page a passage came from?

Every page's text sits under a marker line, --- Page N ---, so scroll or search for that marker. The markers are part of the download too.

Is the text in reading order?

It is in the order the PDF draws it, which is usually reading order for a simple page but not always for columns, tables or text boxes. Headers, footers and page numbers appear wherever the file places them.

Can I extract text from several PDFs at once?

No. One file is processed per run, and Process Another File reloads the page, which clears the box. Download or copy each result before you start the next file.

Last reviewed