Clean Text · browser-local

Remove Extra Spaces

Clean doubled spaces, pasted tabs, and uneven indentation inside ordinary prose. Each line is processed separately so meaningful line breaks remain visible.

Works on up to 5,000 characters and 20,000 code points per field (at most 64 code points per character), processed in your browser.

34 graphemes34 code points34 bytes

Live result

Output

This text has uneven spacing.

Good fit

Use this tool when

  • Copied prose contains doubled or tab-sized gaps.
  • You want consistent single spaces within each line.
  • Line breaks should remain intact.

Keep the original

Avoid it when

  • Spacing aligns plain-text tables or code.
  • Tabs encode nesting or indentation.
  • Whitespace is significant to a file format.
01

Reviewed truth vectors

Examples that expose the edge cases

Inputone two
Outputone two

Repeated spaces collapse to one.

Inputa b
Outputa b

Tabs become a single space.

Input A B
OutputA B

Each line is trimmed independently.

02

Transparent implementation

How it works

  1. 01

    Normalize line endings.

  2. 02

    Collapse horizontal whitespace within each line.

  3. 03

    Trim the start and end of every line while keeping the breaks.

03

Known limitations

What the result cannot promise

Intentional indentation is removed.

Non-breaking spaces may require a separate Unicode inspection.

The tool does not rewrite punctuation or grammar.

04

Questions before copying

Frequently asked questions

Are new lines preserved?

Yes. The default action processes each line independently.

Does it remove tabs?

Runs of tabs and ordinary horizontal spaces become one normal space.

Can it clean a code block?

It can, but should not—indentation is meaningful in many languages.

05

Testing and sources

How this tool is tested

GlyphSift Editorial — Text-engine notes written and reviewed by Hommer Zhao, Founder & General Manager

GlyphSift Editorial is the site's writing and review process, led by Hommer Zhao, who is accountable for every tool page and correction. Each tool's examples are written against real Unicode edge cases and checked against the engine before the page is published.

Each tool page is reviewed against the same six input classes the engine is tested with — ASCII, emoji, combining marks, non-Latin scripts, empty input, and 5,000-grapheme input — and cannot become eligible if it is only a parameter variation of another page.

Automated evidence

  • Tool-contract & coverage suiteShared suite · 37 cases across all tools it covers

    tests/tools-30.test.mjs mirrors the ToolRunner dispatch and asserts every registered engineId returns the contracted output shape, plus a coverage guard: every style keeps one output character per input character with unmapped characters passed through in place, and strikethrough, zalgo and upside-down never drop or split a grapheme cluster.

    Run in: node --test after a production build (vinext build)
  • Rendered-HTML suiteShared suite · 26 cases across all tools it covers

    tests/rendered-html.test.mjs renders the deployed server bundle and asserts the Unicode-version manifest and each wave's tool markup are present in the server-rendered HTML.

    Run in: node --test against the built dist/server bundle
  • Transform & cleanup suiteShared suite · 38 cases across all tools it covers

    tests/transform-cleanup.test.mjs exercises each deterministic cleanup and transform action against whitespace, duplicate, ordering, casing, and HTML-to-text edge cases.

    Run in: node --test, no network, no randomness

Standards this tool follows