Trim Whitespace

Remove spaces and tabs from the start and end of every line, plus empty lines at the top and bottom.

How the trim whitespace works

Each line is trimmed on both sides, which removes indentation and trailing spaces. Blank lines at the very start and end of the text are removed. Spaces between words are not touched.

Everything runs in your browser. Your text is not uploaded or stored.

Example

Input
   first line   
	second line	
  third line
Result
first line
second line
third line

Frequently asked questions

Does it remove spaces between words?

No. Only whitespace at the start and end of each line is removed.

Does it remove indentation?

Yes. Leading spaces and tabs on every line are removed.

More text tools

All of these are also available together on the Text Tools page.