Category: Text tools

Remove Extra Spaces and Empty Lines

Community idea by 小雨 #C5N2Missing a tool?

Five independent toggles for line endings, line edges, repeated spaces, blank lines and the whole text

Paste text and tidy the whitespace with five toggles: normalize line endings, trim each line, collapse repeated spaces and tabs, drop empty lines, trim the whole text.

Output
Line one has trailing spaces.
Line two



Line three with a tab and extra spaces.
Characters before89Characters after81Lines before7Lines after6

Everything on this page is processed in your browser. Nothing is uploaded.

What this tool does

This text cleaner works on whitespace only, through five independent toggles you can mix freely. Normalize line endings rewrites CRLF and bare CR to LF. Trim lines removes spaces and tabs from the start and end of every line without touching the gaps between words. Collapse spaces squeezes runs of spaces and tabs down to a single space, which by design means your original indentation width is not preserved. Remove empty lines drops lines with no content, but it never joins all your line breaks into one paragraph. Trim text only clears whitespace at the very start and end of the whole input. Every change to the text or the options recalculates the result immediately and updates the before and after character counts, which use Unicode-aware character spreading, and the before and after line counts. A sample input and a clear control are available, and the cleaned text sits in a copyable output panel. Nothing else is in scope: no grammar or spelling correction, paraphrasing, AI rewriting or summarization; no duplicate-line removal, sorting, find-and-replace, regex replacement or case conversion; no HTML stripping, Markdown conversion or entity decoding; no language detection or translation; no file picker, batch processing, download file, saved history or cloud sync; and no custom whitespace regex or delete-every-space option. The source text and the cleaned output stay in the browser and are not uploaded to LocalTools.

How to use it

  1. Paste your text, or load the sample to see what each option does first.
  2. Turn on the toggles you need: normalize line endings, trim lines, collapse spaces, remove empty lines and trim the whole text.
  3. Compare the before and after character and line counts, then copy the result; dedupe, sorting, find-and-replace and rewriting are out of scope.

Privacy

This tool runs entirely in your browser. Your input is never uploaded, stored or shared — closing the tab removes it.

Frequently asked questions

How do I remove extra spaces from text?
Paste the text and enable collapse spaces. Runs of spaces and tabs become a single space, and the result updates as you type.
Do you upload my text?
No. The cleanup runs in your browser, and neither the source text nor the cleaned output is sent to LocalTools or stored as history.
How is removing extra spaces different from trimming?
Collapse spaces works inside the line, turning repeated spaces and tabs into one. Trim lines only clears the start and end of each line, and trim text only the ends of the whole input.
Which line endings does it handle?
With normalize line endings enabled, CRLF and bare CR are rewritten to LF, so text pasted from Windows or older Mac sources uses one convention.
Does collapsing repeated spaces destroy my indentation?
Yes, that toggle flattens every run of spaces and tabs to one space, including leading indentation. Leave it off if you need aligned columns or code indents.