Input

or drop a file here, or paste code below

0 lines · 0 characters

Result

0 lines · 0 characters · 0 line(s) changed, 0 character(s) removed; 0 no-break space(s), 0 invisible character(s), 0 tab(s) fixed

Files never leave your browserHow?

Trim whitespace, collapse spaces, convert tabs

This tool removes extra spaces from text: it trims the start and end of every line and collapses repeated spaces into one. It also fixes no-break spaces, tabs and invisible zero-width characters that ordinary trimming misses.

Last updated:

How it works

  1. Paste the text

    Text from web pages, PDFs, spreadsheets and Word documents often carries invisible characters. Paste it or open the file.

  2. Pick the clean-up

    Each fix is a switch: trim starts, trim ends, collapse repeats, normalize Unicode spaces, remove invisible characters, expand tabs.

  3. See what changed

    The summary counts changed lines, removed characters, replaced no-break spaces and deleted invisible characters.

Features

  • Trim and collapse

    Remove indentation and trailing spaces, and squeeze runs of spaces and tabs inside a line into a single space. Indentation is kept when only line ends are trimmed.

  • No-break and Unicode spaces

    U+00A0 no-break spaces and the thin, en, em and ideographic spaces look like normal spaces but break search, comparisons and CSV imports. They become ordinary spaces.

  • Invisible characters

    Zero-width spaces, word joiners, byte order marks in the middle of text and soft hyphens are removed. The zero-width joiner used by emoji and many scripts is left alone, so 👨‍👩‍👧 stays one emoji.

  • Tabs to spaces

    Tabs are expanded to the next tab stop (2, 4 or 8 columns), so aligned columns in code and plain-text tables stay aligned.

Limits & privacy

Text and files can be up to 200 MB; files above 8 MB stream through a background worker. Each line is cleaned on its own, so memory use stays low.

Trimming affects spaces, tabs, vertical tabs and form feeds. With “No-break spaces → normal spaces” on, Unicode spaces are converted first, so they are trimmed and collapsed too. Column positions for tab stops are counted in characters (code points), which matches monospaced fonts for most scripts.

Nothing is uploaded; the text is processed in your browser. See the privacy page.

FAQ

How do I remove double spaces from text?

Paste the text with Collapse repeated spaces on (the default). Every run of two or more spaces or tabs inside a line becomes one space.

Why does my text still look like it has spaces after trimming?

It probably contains no-break spaces or other Unicode spaces. Keep "No-break spaces → normal spaces" on; the summary shows how many were replaced.

What is a zero-width space and why remove it?

U+200B is an invisible character that web editors and chat apps insert. It makes two identical-looking words different, so search and duplicate checks fail.

Will line breaks be removed?

No. Lines stay as they are; only spaces within them change. To remove empty lines or join lines, use Remove Empty Lines or Remove Line Breaks.

Can I keep code indentation?

Turn off Trim line starts. Trailing spaces and repeated inner spaces are still cleaned, and the leading indentation is kept.

Does it work on large files?

Yes, files up to 200 MB are cleaned line by line in a background worker.

Related tools