Trim Lines

Remove leading and/or trailing whitespace from every line, without touching the spaces between words.

Options
Trim

Processed in your browser. Nothing you type is uploaded.

How it works

Each line is trimmed independently: at the start, at the end or at both ends. Spaces, tabs, non-breaking spaces and other Unicode whitespace are removed. Nothing inside the line changes, and line order and count stay the same.

Rules this tool follows

  • “Both ends” is the usual choice for lists and data.
  • “Start only” removes indentation; “End only” removes invisible trailing spaces, which many code style checkers flag.
  • Empty and whitespace-only lines become empty lines; they are not deleted.

Example

Input

   apple   
	banana
cherry    

Output

apple
banana
cherry

Common uses

  • Cleaning values pasted from spreadsheets before comparing or deduplicating them.
  • Removing trailing spaces from code or configuration files.
  • Removing indentation from quoted or nested text.

Limitations and notes

All text cleaners