Two kinds of PDF, two ways to get the text
Most PDFs created by Word, Google Docs, a website or an accounting system contain a text layer: the actual characters, stored alongside their positions on the page. Reading that layer is fast and exact, and it’s what the tool at the top of this page does, in your browser, in a second or two.
Scanned PDFs are different. They contain photographs of pages, so there are no characters to read, only pixels. Getting text out of them needs OCR (optical character recognition), which is much heavier work. For those files we provide an OCR engine further down this page.
Quick test: open the PDF and try to select a word with your mouse. If you can highlight individual words, the file has a text layer. If you can only draw a box over the whole page, it’s a scan.
How to extract text
- Choose a PDF.
- Set the options. Mark page breaks adds a line such as
--- Page 4 ---between pages, which helps when you need to cite or find something later. Re-join words split with a hyphen turns “experi-” + “ment” back into “experiment”. - Press Extract text. The text appears in a box you can scroll, copy, or download as a UTF-8
.txtfile that opens in any editor.
If some pages have no text layer, the tool lists them. That usually means a document was assembled from typed pages and scanned pages, for example a signed contract. Run just those pages through the OCR engine below.
How the text is put together
Inside a PDF, text is stored as fragments placed at coordinates, not as paragraphs. The tool groups fragments that sit on the same line, orders them left to right, and inserts spaces where there are gaps. Large gaps, such as between table columns, become tab characters, so pasting into a spreadsheet often puts columns in separate cells.
This works very well for letters, reports, invoices and most books. Two layouts need a little care:
- Two-column articles: lines are read straight across the page, so the left and right column appear on the same line separated by a tab. Splitting the columns back apart in a spreadsheet, or using PDF to Markdown, can help.
- Text set in unusual encodings: some older PDFs store characters without a proper mapping to letters. Extracted text then looks garbled even though the page looks fine. OCR is the reliable fix.
Why extract text at all?
- Quote or reuse a passage without retyping it.
- Paste a long document into a translator, an AI assistant or a word counter.
- Make a document searchable in a notes app.
- Check what text a PDF really contains, including hidden or white text, before you publish it.
Scanned PDFs: OCR engine for scanned PDFs
The tool at the top of the page reads text that’s already in the PDF. For scanned pages you can use the external engine below. It does more work (recognising characters in page images), takes longer, and requires uploading the file to a third-party service.
Load the external engine
OCR engine for scanned PDFs runs on an open-source application hosted on Hugging Face Spaces by its independent developer, not on ilovpdf. When you load it, your browser connects to pszemraj-pdf-ocr.hf.space, and files you upload in the panel are sent to that service.
- Don’t upload confidential or personal documents (ID cards, medical, financial or legal records) to external engines.
- If the engine hasn’t been used for a while it may take up to a minute to start. Occasionally it may be unavailable; try again later.
- We check each engine regularly and replace engines that stop working well.
Frequently asked questions
Is my PDF uploaded?
Not for normal text extraction: it happens in your browser. Only if you choose to load the OCR engine and upload a scan there is the file sent to that external service.
Why does it say no text was found?
The PDF is almost certainly a scan or a photo of pages. Use the OCR engine further down the page.
Does it keep formatting such as bold or headings?
No. The output is plain text. For headings and lists, try PDF to Markdown; for an editable layout, try PDF to Word.
Which languages are supported?
Any language whose text is stored in the PDF, including non-Latin scripts such as Chinese, Arabic and Hindi.
What encoding is the .txt file?
UTF-8, which every modern text editor, spreadsheet and programming language opens correctly.
This tool is built and maintained by ilovpdf. It runs entirely in your browser using the open-source pdf-lib and PDF.js libraries, which we host ourselves. Your file is read and processed on your device and is never uploaded. See our Privacy Policy.