Text copied from a PDF
Even out the irregular spacing of a passage recovered by copy and paste.
Tidy up text pasted from a PDF, an email or a web page by trimming line edges, collapsing runs of spaces and tabs and removing empty lines, without changing the words themselves.
Remove unwanted spaces and empty lines from text copied out of a document, an email or a web page. You choose exactly which corrections to apply: trimming spaces at the start and end of each line, collapsing repeated spaces and tabs, or deleting empty lines. The result is produced locally in your browser and can be copied or downloaded.
The tool offers three independent options, all switched on by default. The first removes spaces at the start and end of every line. The second replaces any run of ordinary spaces or tabs with a single space. The third deletes lines that are completely empty once the other options have run. Line breaks are normalised first, so text coming from Windows or another system ends up with consistent line endings. To keep the indentation of a code snippet, switch off line trimming and space collapsing: those characters can be part of the syntax. Likewise, keep empty lines when they separate paragraphs or blocks of data. This cleaner does not fix spelling or punctuation, does not change letter case and has no option for removing repeated lines; use the dedicated tool to deduplicate a list. Start with a small extract when you work with Markdown, CSV or any data whose layout carries meaning, and check the result before copying it or downloading the text file. Before cleaning structured text, choose the options one by one. A list of names usually tolerates collapsed spaces, whereas a code extract or a table aligned with tabs may depend on them. After processing, review the passages where line breaks and indentation have a particular meaning.
Type or import the text you want to clean.
Turn the three options on or off according to the structure you need to keep.
Click the clean button, review the result and copy or download it.
Even out the irregular spacing of a passage recovered by copy and paste.
Remove the empty lines from a list of references or names.
Get rid of stray spaces before pasting text into an email.
All three options are on: the line edges are trimmed, the triple space becomes one and the empty line disappears.
Input
alpha beta
gamma Result
alpha beta
gammaOnly space collapsing is on: tabs and repeated spaces become a single space, and the empty line stays.
Input
Name: Smith
City: LeedsResult
Name: Smith
City: LeedsNo. You can turn each one on separately or combine them, depending on the result you want.
When space collapsing is on, any run of spaces and tabs is replaced with a single space. With that option off, tabs are left as they are.
No. None of its three options deletes repeated lines; use the dedicated tool for removing duplicate lines.
Yes. Switch off the option that removes empty lines to keep the separations.
No. The cleaning runs in your browser, and you can then copy or download the result.
Related tools
Tools similar or complementary to this one.
Automatically remove empty lines and lines containing only spaces from a text.
Convert text to lowercase, UPPERCASE, Title Case or other common case styles.
Replace a text fragment in a pasted or imported document.