Text Tool

Collapse Whitespace

Collapse Whitespace helps clean or transform pasted text quickly in the browser. Use it online on EasyTools99.

Tool area

Everything runs in the browser.

Reference results

InputResult
Room A Seat 4Room A Seat 4
Market SquareMarket Square
Sample line Sample line
18 Market Street18 Market Street
Indoor courtIndoor court
Saturday at 10Saturday at 10

How it works

The filter replaces each run of whitespace with a single space. It then trims the edges of the result. Tabs and line breaks follow the same rule, so a block of text becomes one line. Use it for material where the layout carries no information you need to retain.

Worked examples

  1. A ticket clerk copies a room and seat from a receipt that displays them on separate lines. She uses the one-line result for the short description and keeps the exact room and seat in the booking record’s separate fields.
  2. An assistant copies the square’s name from a tabular listing and finds a tab between the words. He flattens the spacing for a poster, then checks the spelling against the venue calendar before sending the poster for layout.
  3. An editor receives a caption with blank margins and repeated spaces. She flattens the caption and reads it against the others in the exhibition to check that the punctuation still identifies each part of the credit.

Common mistakes

  • Leave line breaks intact when they distinguish list items. Flattening a list can make consecutive entries look like one item.
  • Tabs in a text table may mark column boundaries. Replacing them with spaces removes the boundaries that an importer expects.
  • Preserve non-breaking spaces if they are part of your published typography, such as a space between a value and its unit.

FAQ

Are paragraphs preserved?

Runs of line breaks become a single space between adjacent words, so paragraph boundaries disappear.

Does it fix punctuation?

It acts on whitespace. The punctuation in the source stays in its original order.

What happens when the input contains only spaces?

The result is empty because leading and trailing whitespace is removed.

Related tools

Browse all text tools

Related guides

Previous tool Character Counter Next tool Remove Blank Lines