Remove Extra Spaces and Tidy Every Line
Runs 100% in your browser — your text never leaves this page, and nothing is uploaded or stored.
This remove extra spaces tool collapses runs of spaces into one, turns tabs into single spaces and trims ragged line edges — while protecting code indentation if you ask. Paste text full of double spaces to remove double spaces in text and fix extra spaces in a document in one pass — single spaces between words are never touched, and code indentation can be protected.
How to use the Remove Extra Spaces
- Paste your text into the box — or press Load sample to clean the example with its mixed tabs and wide gaps.
- Leave the defaults on for a standard tidy: tabs become single spaces, and every line is trimmed at both ends.
- Tick Keep line indentation instead if the text is code or a structured list whose leading spaces must survive.
- Read the cleaned text in the result box — runs of spaces have collapsed to one everywhere, line by line.
- Copy the result, or download it as a text file, ready to paste wherever it needs to go.
About this tool
Extra spaces arrive from everywhere: PDFs that pad their columns, OCR scans that guess at gaps, old typewriter habits (two spaces after every full stop) and copying out of spreadsheets. They make text look ragged — and they can break data imports that expect exact values. The cleanup is precise about what it touches. Every run of two or more spaces collapses to exactly one. Tabs — converted by default — each become a single space. Trailing whitespace at the end of every line is always removed, and with Trim start and end of every line (also on by default) the padded starts go too. What never happens matters just as much: single spaces are never removed, and line breaks are never touched. Programmers and list-keepers get an escape hatch. Tick Keep line indentation and the leading whitespace of each line is preserved exactly as pasted, while everything after the indent is cleaned as usual — tidy lines without flattened structure. Like every cleaner here, it works instantly on pastes of any size and runs entirely in your browser. For a full rescue job, chain it with its neighbours: rejoin broken lines first, close the blank gaps, and finish with this spacing pass. If your pasted text also has lines broken by hard wraps, rejoin them first with Remove Line Breaks.Worked example
Here is the sample text that comes with the tool, cleaned with the default settings (tabs on, trim on, indentation off): You pasteThis sentence has far too many spaces. And tabs mixed in, too. Plus padded line starts and trailing spaces.You get
This sentence has far too many spaces. And tabs mixed in, too. Plus padded line starts and trailing spaces.Every wide gap collapsed to a single space, the tabs in the second line became single spaces too, and the third line lost both its padded start and its trailing spaces. Count the lines: still three — this cleaner fixes the spacing inside lines, never the breaks between them.
Features
- Collapses every run of two or more spaces to one, across the whole paste, in a single pass.
- Tab conversion (on by default): each tab becomes a single space, so tabbed columns align with typed text.
- Per-line trimming of leading and trailing space, on by default, for flush, professional edges.
- An indentation-safe mode that preserves leading whitespace exactly — built for code and nested lists.
- Line breaks and single spaces are never touched: your structure survives, only the mess goes.
- Private by design: cleaning happens in your browser; your text is never uploaded.