Skip to content
Text Cleanup Tools

Text Cleanup Tools › Spaces and line breaks

Trim Whitespace

Cut the spaces and tabs off the start, the end or both ends of each line, and leave the spacing inside lines alone.

Processed on your device. Nothing is uploaded or stored on a server.

How it works

  1. Paste the text with the extra whitespace.
  2. Choose whether to trim the start of each line, the end, or both.
  3. Copy the result.

Example

Before
Name: Ada   
	Role: engineer  
   City: London	
After
Name: Ada
Role: engineer
City: London

What this tool does

This tool only trims the edges of lines. Spaces between words are left exactly as they are, which is the difference from the extra spaces tool that squeezes every run of spaces down to one. That matters for tables and aligned columns, where the inner spacing carries meaning. Whitespace here includes ordinary spaces, tabs and non-breaking spaces, so lines that start with a pasted tab or a stray no-break space come out clean. Trailing spaces are a common reason that two lines that look identical do not match in a comparison, a database import or a version control diff, so trimming the end of lines is often the first step before comparing. Empty lines are kept unless you ask to drop the ones at the very start and end.

Common problems

Lines still look indented after trimming

The indentation may be made of hidden characters that are not whitespace, such as zero-width spaces. Run the hidden character remover first.

I want to remove spaces inside lines too

Use the extra spaces tool. It collapses runs of spaces to one and can trim the line edges in the same pass.

Questions

Does it remove blank lines in the middle of the text?

No. Blank lines inside the text stay. Use the blank line remover for those. The edge option only removes empty lines at the very start and end.

Why trim the end of lines?

Invisible trailing spaces make identical-looking lines compare as different, cause noisy changes in version control and can break imports.

Does it change the words or punctuation?

No. Only the edges of each line are cut. Words, punctuation and line breaks stay as they are.

Related tools

Guides

Last reviewed 2026-10-14.