ToolGlint

Whitespace and Line Break Remover

Remove extra spaces, tabs, blank lines and line breaks from text, or trim every line. Free and runs in your browser.

Paste or type, or drop a file on the box.

Runs in your browser. Nothing you enter is uploaded or stored.

How to use the Whitespace and Line Break Remover

  1. Paste your text into the left box, or load the sample to try it.
  2. Tick “Trim every line” to remove spaces and tabs at the start and end of each line.
  3. Tick “Extra spaces and tabs to one space” to tidy the gaps between words.
  4. Choose what to do with blank lines: keep them, allow one at a time, or remove them all.
  5. To put the text on a single line, set Line breaks to “Replace with a space” or “Remove”, then copy the result.

Questions and answers

Is my text sent to a server?
No. The cleaning runs in your browser. Nothing you paste is uploaded, stored or logged.
How do I remove line breaks from text copied out of a PDF or an email?
Set Line breaks to “Replace with a space”. Every line is joined to the next with a single space, which turns hard-wrapped text back into a normal paragraph. Use “Remove” only when the pieces should be joined with nothing between them, such as a long code or key split over several lines.
What counts as whitespace?
Spaces, tabs and line breaks, along with the less visible ones: the non-breaking space that web pages and word processors insert, and the other space characters defined by Unicode. These often survive a copy and paste and look identical to a normal space, and this tool treats them all the same way.
What does “One at most” do for blank lines?
It keeps your paragraphs apart but removes the extra gaps: wherever there are two or more blank lines in a row, one is left. A line that holds only spaces or tabs counts as blank.
Will it change the spaces inside my code or data?
It can. Collapsing spaces removes indentation inside a line and would change text where spacing matters, such as Python or YAML, columns lined up with spaces, or a quoted string with deliberate gaps. For those, untick that option and use only “Trim every line” or the blank line setting.
Why is the blank lines choice greyed out?
When line breaks are replaced or removed, every line is joined into one, so blank lines disappear in any case and the setting has nothing left to decide.

Related tools