Remove extra whitespace, tabs, and line breaks from text.
The Whitespace Remover cleans spaces, tabs and line breaks from text with four actions. Remove extra spaces collapses runs of spaces and tabs to one space and strips spaces from the end of each line. Trim each line removes only the spaces at the start and end of every line. Remove all spaces deletes every space, tab and line break, and Normalize all turns the whole text into single-spaced text on one line. It all happens in your browser.
Made for writers and students. Typical uses:
The text " Hello world <tab> again " followed by " second line " on a second line becomes " Hello world again" and " second line" with Remove extra spaces, "Hello world <tab> again" and "second line" with Trim each line, "Helloworldagainsecondline" with Remove all spaces and "Hello world again second line" with Normalize all.
Remove all spaces joins words together, so use it only for codes and numbers and not for sentences. The tool changes whitespace only; it does not fix punctuation, capitalisation or line wrapping from a PDF.
Accuracy: Results follow documented rules and are tested with known inputs. Review the output before relying on it.
Expert Tip
Pick the mildest action that does the job. Trim each line keeps the spacing inside a line, which matters for indented lists and code, whereas Normalize all destroys that structure.
The Whitespace Remover offers four actions, each doing a different job. Take the text " Hello world \t again " followed by a new line and " second line ".
Use Remove extra spaces for prose where double spaces crept in, which often happens when text is typed with two spaces after a full stop or pasted from a layout. Use Trim each line for lists and code, where the indentation inside a line may matter but the edges do not. Use Remove all spaces for identifiers such as account numbers or serial numbers that were typed with gaps. Use Normalize all to flatten a messy block into a single clean line.
Whitespace is more than the space bar. It includes tabs, line breaks and some invisible characters. Text copied from the web or from a word processor can contain non-breaking spaces that look like ordinary spaces but are different characters, which is why a search for a double space sometimes finds nothing. The cleaning actions treat these as whitespace.
Be careful with Remove all spaces on sentences: it joins the words together. It is meant for codes and numbers, not for prose.
To join lines that were broken by a PDF, use the Line Break Remover. To remove repeated lines, use the Duplicate Line Remover. To see how much you removed, compare the before and after with the Character Counter. Everything runs in your browser and nothing is uploaded.
Extra whitespace is invisible, which makes it a common cause of mistakes. A name with a trailing space, "Alice ", does not match "Alice" in a spreadsheet lookup or a form validation. Trailing spaces create noisy changes in version control. Mixing tabs and spaces breaks Python indentation, and YAML does not allow tabs for indentation at all. Non-breaking spaces copied from a web page look like ordinary spaces but fail exact matches. Cleaning the text before you import it, search it or commit it avoids all of these. Check again after pasting from a new source, because every program adds its own habits.
Explore more in Text Tools, read the guides and articles, or see how we test our tools.
Remove unwanted line breaks from text instantly.
Best for fixing text copied from a PDF where every line ends with a hard break
Remove duplicate lines from any text instantly.
Best for cleaning a merged email or contact list
Clean up text by removing extra spaces, special characters, and formatting.
Best for removing HTML tags from copied web content
Count characters, letters, and spaces in any text.
Best for fitting a post, caption or bio inside a platform limit
Convert text to uppercase, lowercase, title case, sentence case, and more.
Best for converting titles and headlines to title case