Tools
Remove extra spaces
Remove extra spaces from text
Strip double spaces, stray tabs and leading or trailing whitespace from every line.
About this tool
Extra spaces creep in when you copy from a PDF, a web page or a spreadsheet, and they cause trouble when you compare data, import a CSV or paste text into a CMS. This tool leaves a single space between words, turns tabs into spaces and trims the whitespace at the start and end of every line, without touching your line breaks or content.
Paste your text and press “Remove extra spaces”. If you also want to delete blank lines, use “Remove empty lines” in the Clean up panel; if you need to turn text broken over several lines into one paragraph, “Join lines” merges everything with single spaces. Copy the result with the button alongside and, if something isn’t right, Ctrl+Z undoes it.
Everything runs in your browser and the text is never sent to a server. Note that tabs are also replaced with a single space, so this isn’t suitable for indented code or tab-separated data. Non-breaking spaces ( ) are treated like any other space.
Frequently asked questions
Will it remove my line breaks?
No. Only surplus spaces and tabs inside each line and at its ends are removed; lines and paragraphs stay as they are.
Why does text copied from a PDF have so many spaces?
Many PDFs position each word or line separately, and copying adds spaces to imitate the layout. This tool collapses them to one.
Is it the same as Excel’s TRIM function?
Similar, line by line, but it also handles tabs and non-breaking spaces, which TRIM leaves alone. Don’t use it on tab-separated columns, though, as the tabs would become spaces.
What is a non-breaking space?
A special space ( ) that stops two words being split across lines. It often comes from web pages and is converted to a normal space here.