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
- Paste the text with the extra whitespace.
- Choose whether to trim the start of each line, the end, or both.
- Copy the result.
Example
Name: Ada Role: engineer City: London
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
- Remove Extra Spaces
- Remove Blank Lines
- Remove Zero-Width Characters
- Text Diff Checker
- Remove Line Breaks
Guides
- Invisible characters in text: what they are and how to remove them
- How to remove duplicates from a list, and clean it first
Last reviewed 2026-10-14.