Skip to content
PocketDesk
Your files are processed on your device, never uploaded

Remove extra spaces

Tidy messy spacing in one step. Your text stays in your browser.

  • Runs in your browser
  • No sign-up
Result

How to remove extra spaces

  1. Paste your text into the box.
  2. Keep the options you need switched on: Collapse repeated spaces, Trim spaces at line ends, Turn tabs into spaces, and optionally Remove blank lines.
  3. Check the Characters removed tile.
  4. Copy the cleaned text, or download it.

When it helps

Extra spaces creep in when you copy from PDFs, web pages, spreadsheets and chat apps. They make text look uneven, break exact matching in spreadsheets and databases, and inflate character counts. Typing two spaces after a full stop, an old typing habit, is another common source.

The tool works line by line. It first turns tabs into single spaces if you ask for that, then shrinks every run of two or more spaces, including non-breaking spaces, down to one. Finally it trims spaces from the start and end of each line. Your line breaks and their style are kept, so a file keeps its Windows or Mac format.

Remove blank lines goes one step further and drops lines that are empty or hold only spaces. This is useful for lists, but it also removes the gaps between paragraphs, so leave it off for normal writing.

Tips

Good to know

Spaces are only changed within a line. A space between two words is never removed completely, only shortened to one. Non-breaking spaces from web pages are treated like normal spaces when collapsing. Other kinds of space, such as the wide space used in Chinese and Japanese text, are left alone, because they are often written on purpose.

Privacy

Your text is processed on your device. It is not uploaded, saved on a server, or added to the page address.

Questions

What counts as an extra space?

Two or more spaces in a row become one. Spaces at the start and end of each line can also be removed.

Does it touch line breaks?

No, unless you turn on Remove blank lines. Your line breaks stay where they are.

What happens to tabs?

With Turn tabs into spaces on, each tab becomes a space, and repeated spaces are then collapsed.

Will it remove the indentation in my code?

Trimming line ends also removes leading spaces. Turn off Trim spaces at line ends and Collapse repeated spaces if you want to keep indentation.

Is my text uploaded?

No. Cleaning runs in your browser, and your text never leaves your device.

More text tools