Skip to content
1001 Tools
sr
Text tools

Text Cleaner

Paste text copied from a PDF, email or web page and clean it up in one pass. Trim ragged spacing, collapse doubled spaces, convert tabs, drop blank lines, and remove the invisible zero-width characters that sneak in and break search or formatting. Every option is a toggle, and it all runs in your browser.

Cleaned text

How it works

The cleaner works line by line. It can convert tabs to spaces, collapse runs of two or more spaces into one, and trim leading and trailing whitespace from each line. Line endings are normalised to a single style first, so text from Windows and other sources is handled the same way.

The “strip invisible characters” option removes zero-width spaces, zero-width joiners, the word joiner and byte-order marks — characters you can’t see but that cause mysterious bugs when a string won’t match or a name looks duplicated. Optionally it also drops empty lines entirely, leaving compact, predictable text.

Practical examples

Cleaning a spreadsheet paste

Text pasted from a spreadsheet often has tab characters and trailing spaces. Turning tabs into spaces and trimming lines gives clean, uniform rows.

Catching an invisible character

A product code copied from a website silently included a zero-width space, so it never matched in search. Stripping invisibles makes it match again.

Tightening up a draft

A draft with random double spaces and blank lines becomes tidy: doubles collapse to singles, and enabling “remove empty lines” closes the gaps.

Frequently asked questions

What are invisible characters and why remove them?

They’re characters with no width — zero-width spaces, joiners, byte-order marks — that can hide inside pasted text. They break exact matching, inflate character counts and cause “identical” strings to differ. Stripping them avoids hard-to-spot bugs.

Does collapsing spaces affect single spaces?

No. Only runs of two or more spaces are reduced to one, so normal word spacing is untouched. Combined with trimming, it removes the ragged spacing typical of copied text.

What’s the difference between this and remove-extra-spaces?

This tool bundles several cleanups — tabs, blank lines and invisible characters — as toggles. If you only need to squeeze spaces, the dedicated remove-extra-spaces tool is simpler; use this when text needs a broader tidy-up.

Will it change my line breaks?

It normalises line endings and can optionally drop empty lines, but it keeps the line structure otherwise. To join everything into one block, use the remove line breaks tool instead.

Does trimming remove indentation?

Yes — trimming removes leading and trailing whitespace on each line, including indentation. If you’re cleaning code where indentation matters, turn “trim lines” off and keep only the options you need.

Are tabs always converted?

Only when the tabs-to-spaces option is on. Each tab becomes a single space; if you need a specific tab width, expand tabs before pasting.

Can I keep blank lines?

Yes. “Remove empty lines” is off by default, so blank lines are preserved unless you choose to drop them.

Is my text uploaded?

No. All cleaning happens locally in your browser, so even sensitive text stays on your device.

Related tools