How to clean up text copied from a PDF or website
Fix broken lines, double spaces, curly quotes, invisible characters and leftover HTML in text copied from PDFs, emails and web pages.
· 1 min read
Copying text out of a PDF usually gives you a line break at the end of every line, double spaces and odd characters. Web pages and emails add curly quotes, non-breaking spaces and sometimes raw HTML. Here's a quick clean-up routine.
1. Get the text out
If you're starting from a PDF file, PDF to text extracts all pages at once, which is faster than selecting text page by page. (If the result is empty, the PDF is a scan — an image — and needs OCR.)
2. Rejoin broken lines
PDFs store text as positioned lines, so a paragraph copied out becomes many short lines. In the Text cleaner, Join broken lines replaces single line breaks with spaces while keeping blank lines between paragraphs — so paragraphs survive.
3. Normalise spaces and invisible characters
Text from Word and websites often contains:
- non-breaking spaces (U+00A0), which look normal but break searches and spreadsheet lookups;
- zero-width spaces, completely invisible;
- double spaces after full stops.
Remove extra spaces fixes all three.
4. Straighten quotes (for code and data)
Curly quotes (“ ” ‘ ’) are right for published prose but break code, CSV files and JSON. Turn on Straighten smart quotes in the text cleaner when the text is headed for a program.
5. Remove blank lines
For lists, Remove empty lines produces one item per line, ready to paste into a spreadsheet column.
Privacy
All of these tools run in your browser. It's safe to clean up confidential documents: nothing is uploaded or stored.