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
| Button | What it does | Good for |
|---|---|---|
| Trim Lines | Removes spaces and tabs from both ends of each line | Indentation left over from email quoting or code blocks |
| Remove Blank Lines | Deletes every line that is empty or only spaces | PDF copies with a gap after every line |
| Remove Duplicates | Keeps the first copy of each identical line and drops later ones | Merged lists of names, tags or sources |
| Sort A-Z and Sort Z-A | Orders the lines alphabetically, using your browser's language rules | Glossaries, bibliographies, keyword lists |
| Reverse Lines | Puts the last line first | Turning a newest-first log into date order |
| Add Line Numbers | Prefixes each line with 1., 2., 3. and so on | Sending a list for comment so people can refer to items |
| Remove Extra Spaces | Squeezes any run of spaces or tabs inside a line to one space, and trims the ends | Double spaces after full stops |
Details that trip people up
- Duplicates must match exactly. "Smith, J." and "Smith, J. " with a trailing space count as different lines. Run Trim Lines first, then Remove Duplicates.
- Remove Blank Lines also removes paragraph breaks. If your text uses an empty line between paragraphs, this button merges them into one block of lines. For PDF text where every line is followed by a blank, that is what you want; for normal prose it is not.
- Sorting is by the whole line. A list of "Firstname Lastname" sorts by first name. Reorder names before sorting if you need surname order.
- Nothing is fixed inside lines. The cleaner does not join lines that were broken mid-sentence. For that, a find-and-replace in your editor is the better tool.
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.