Remove Extra Spaces

Paste messy text and get clean single-spaced lines instantly.

Options

The result updates as you type. Ctrl + Enter cleans now.

Cleaned text

How to remove extra spaces

Paste your messy text into Your text, or press Load example. Runs of extra spaces collapse to one and the cleaned version appears next to it, updating as you type. Copy the result or download it as a .txt file. Everything runs in your browser, so nothing you paste is uploaded.

Examples

InputOutput
This has extra spaces. This has extra spaces.
Tabs and trailing Café naïve 😀 Tabs and trailing Café naïve 😀
a b c d a b c d

Limits and edge cases

  • Horizontal space means regular spaces, tabs, form feeds, vertical tabs and non-breaking spaces (NBSP).
  • Newlines are never collapsed: blank lines and paragraph breaks stay exactly where they are.
  • Windows CRLF (\r\n) line endings are preserved line by line.
  • With Trim each line on, leading and trailing spaces are removed from every line; turn it off to keep a single indent or trailing space.

Frequently asked questions

How do I remove extra spaces from text?

Paste the messy text into the input box and the cleaned version appears instantly in the result box. Copy it or download it as a .txt file.

Does it handle tabs as well as spaces?

Yes. Runs of spaces, tabs, form feeds, vertical tabs and non-breaking spaces are all collapsed into a single regular space.

Will it join my lines together?

No. Newlines are never touched, so paragraphs and blank lines stay exactly where they are. Only spacing inside each line is collapsed.

What happens to non-breaking spaces (NBSP)?

Non-breaking spaces count as horizontal spacing, so runs of them collapse into a single regular space like any other extra spaces.

Is my text uploaded anywhere?

No. Cleaning runs in your browser with JavaScript and nothing is sent to a server. Inputs under 200 KB are kept in your browser's local storage so they are still there when you come back.

What does the Trim each line option do?

When it is on, leading and trailing spaces are removed from every line. Turn it off if you want to keep one indent or trailing space at the edges of each line.