Text formatter
Clean up messy text. Trim whitespace, collapse spaces, strip blank lines, convert smart quotes, normalise line endings. Stack any combination, with a live preview and before/after character counts.
About the Text formatter
The text formatter is a stack of toggleable cleanup passes for messy pasted text. You switch on the fixes you want, trimming line edges, collapsing repeated spaces, removing blank lines, normalising line endings to LF, stripping invisible characters, converting curly quotes to straight, turning dashes into hyphens and squashing runs of punctuation, and the cleaned version updates beside the original.
It is built for the moment after you copy text out of a PDF, an email, a spreadsheet cell or a chat message and the formatting comes along for the ride. Hidden control characters, smart quotes that break code, double spaces and stray blank lines all get cleaned in one pass, and a running character count shows exactly how much the text shrank.
How to use it
- Paste the text you want to clean into the Original box on the left.
- Toggle on the specific transforms you need from the panel, or click All to enable every pass and None to reset.
- Read the Cleaned output on the right; transforms apply in order, top to bottom, and stack on top of each other.
- Check the character counter, which shows the before and after totals and the difference so you can see what was removed.
- Click Copy cleaned to put the result on your clipboard, or Clear to empty the input.
Examples
Cleaning text pasted from a PDF
PDF copy often carries trailing spaces, double spaces and stray non-printable characters. Turn on Trim line edges, Collapse spaces and Remove non-printable chars, and the paragraph collapses to clean single-spaced prose. The counter might show -240 characters, most of them invisible.
Making quotes safe for code
Paste “const name = ‘Ada’” copied from a document and the curly quotes will break a code editor. Switch on Smart quotes to straight and it becomes "const name = 'Ada'" with plain ASCII quotes that compile.
Tidying a list with gaps
A list copied from a webpage has empty lines between items and Windows line endings. Enable Remove blank lines and Normalise line endings to LF, and you get a tight list with one item per line and consistent newlines, ready to paste into a sorter or a script.
Frequently asked questions
- What counts as a non-printable character here?
- The strip pass removes C0 and C1 control codes, the DEL character, zero-width spaces and joiners, the byte order mark, and left-to-right and right-to-left marks. It deliberately keeps tabs, newlines and carriage returns so your line structure survives.
- Does 'Fix double punctuation' delete my ellipsis?
- No. It collapses runs of exclamation marks, question marks, commas and semicolons down to one, so '!!!' becomes '!'. It does not touch full stops, so an ellipsis written as three dots is left intact.
- In what order do the transforms run?
- They run top to bottom in the order shown in the panel, regardless of the order you toggle them. Because each pass feeds the next, normalising line endings before removing blank lines, for example, gives a cleaner result than doing it the other way.
- Why convert em and en dashes to a hyphen?
- Plain-text systems, code, slugs and some forms expect a simple hyphen. The dash pass replaces both the en dash and the em dash with a single hyphen so the text behaves consistently when pasted into those destinations.
- Does collapsing spaces affect indentation?
- It reduces any run of two or more spaces or tabs to a single space, so leading indentation made of multiple spaces will be flattened. If you need to preserve code indentation, leave that toggle off and use Trim line edges only where appropriate.
Good to know
The most valuable passes are usually the ones you cannot see: zero-width characters and stray control codes routinely sneak in from rich-text sources and cause mysterious bugs, failed string comparisons or broken search. Stripping them is often the difference between text that 'looks identical but won't match' and text that behaves. The character difference counter is a quick sanity check, since a large negative number on a short paragraph almost always means invisible junk was present.
Keep two limits in mind. The formatter works line by line on plain text, so it is not a Markdown or HTML cleaner and will not understand document structure. And because Collapse spaces and Trim line edges touch whitespace aggressively, they are not ideal for code where indentation is meaningful. For source code, prefer your editor's formatter and use this tool mainly for prose, data lines and clipboard cleanup.