Home  /  Guides  /  Clean up messy text

Text Formatter Online: Five Cleanup Jobs Almost Everyone Needs

Updated 2026-10-13  ·  7 min read

Text almost never arrives clean. Copy a paragraph out of a PDF and every line ends in a hard break. Copy a reply out of an email thread and every line carries a quote marker. Copy a column out of a spreadsheet and you inherit tabs, padding spaces and inconsistent casing. The good news is that the damage is predictable, which means the cleanup is too.

Advertisement

Why pasted text arrives broken

Three mechanisms do most of the damage. Knowing which one you are looking at tells you which tool to reach for.

  • PDF layout is positional rather than structural. A PDF stores every line at a coordinate, so copying it inserts a hard line break at each visual line end, including in the middle of a sentence
  • Email threads prefix each line with a quote character such as a greater than sign, and repeated replies nest those markers several levels deep
  • Spreadsheets export tab separated values and pad columns with spaces, both of which survive a copy and paste intact

Job one: collapse runs of whitespace

Replace every run of two or more spaces with a single space, and every run of blank lines with a single blank line. This is the least glamorous step and it fixes the most visible damage, because doubled spaces after pasted sentences are the first thing a reader notices.

Job two: remove duplicate lines

Lists assembled from several sources routinely contain the same entry twice, usually with a trailing space or different capitalisation so your eye slides past it. Deduplicating is a one click job once you have decided how strict the comparison should be, and it is worth doing before you count anything, because the count will otherwise be wrong.

Job three: fix inconsistent casing

Text merged from different sources mixes sentence case headings with capitalised ones and the occasional ALL CAPS label. Converting the whole document to sentence case and then restoring the few proper nouns by hand is faster than fixing it line by line.

Job four: count what you have

Once the text is clean, measure it, because whatever number you were quoting before cleanup was inflated by stray line breaks and duplicate entries.

Job five: turn a heading into a slug

If the cleaned text is a heading that is about to become a page, the last step is converting it into a URL slug. Do this after cleanup rather than before, or you will bake stray punctuation into a permanent address.

The order matters

Running these in the wrong sequence means some of them have to be done twice.

  • Strip quote markers and collapse whitespace first, so every later step sees clean input
  • Remove duplicates second, so the count that follows is accurate
  • Fix casing third, so duplicate detection has already finished with the original values
  • Count fourth, because counting is the step you will be most tempted to do first
  • Generate the slug last, and only if the text is going to become a page

Frequently asked questions

Does pasting text into a browser tool upload my data?
A well built formatter runs entirely in JavaScript in your browser, so the text never leaves your machine. That matters for anything confidential. If a tool sends your text to a server you will typically notice a delay while you type.
How do I remove line breaks from text copied out of a PDF?
Replace single line breaks with a space but keep double line breaks, which usually mark real paragraph boundaries. Doing that by hand is error prone, so a formatter that distinguishes the two is faster and safer.
Why does my pasted list contain invisible characters?
Non breaking spaces and zero width characters travel with text copied from web pages and word processors. They survive the paste, are invisible on screen, and cause duplicate detection and search to fail. Trimming whitespace around each line normally removes them.
Should I fix casing before or after removing duplicates?
Remove duplicates first if your comparison can be case insensitive, which handles both problems at once. If you need a case sensitive comparison, fix casing first so the variants collapse into one.