Skip to content
LibriTXT Editing Desk Back to LibriTXT →
LibriTXT Editing Desk Text cleaner

Clean Up Text Pasted From PDFs and Emails

Paste the text, press the operation you need and copy the result. The guide explains each operation, the order to run them in, and the cases that catch people out.

Formatted text will appear here...

Why pasted text needs cleaning

Text copied from a PDF, an email thread, a spreadsheet or a word processor often brings debris with it: spaces at the ends of lines, runs of blank lines, a heading repeated where a page broke, and double spaces between sentences. Most publishing platforms keep some of that debris, and it shows up later as uneven spacing or stray gaps. The cleaner works line by line. Paste the text, press the operation you need, and the result appears in the box below, ready to copy. You can paste the output back in and run another operation if you need two.

The eight operations

ButtonWhat it doesGood for
Trim LinesRemoves spaces and tabs from both ends of each lineIndentation left over from email quoting or code blocks
Remove Blank LinesDeletes every line that is empty or only spacesPDF copies with a gap after every line
Remove DuplicatesKeeps the first copy of each identical line and drops later onesMerged lists of names, tags or sources
Sort A-Z and Sort Z-AOrders the lines alphabetically, using your browser's language rulesGlossaries, bibliographies, keyword lists
Reverse LinesPuts the last line firstTurning a newest-first log into date order
Add Line NumbersPrefixes each line with 1., 2., 3. and so onSending a list for comment so people can refer to items
Remove Extra SpacesSqueezes any run of spaces or tabs inside a line to one space, and trims the endsDouble spaces after full stops

Details that trip people up

A typical clean-up

Say you have copied a reading list out of a PDF and every entry has a blank line after it, some entries are indented, and two entries appear twice because they sat on both sides of a page break. Run Trim Lines, then Remove Blank Lines, then Remove Duplicates, pasting the output back in between steps. Finish with Sort A-Z if the list should be alphabetical. Four clicks replace several minutes of careful manual editing, and the copy button puts the result on your clipboard.