Trim Text Lines
Strip leading and trailing whitespace from every line of a text.
About this tool
Trim Text Lines removes leading and trailing whitespace from every line, the kind of invisible clutter that breaks exact matches in lookups and comparisons. Trim one side only when indentation must be preserved.
See also Remove Extra Spaces and Remove Empty Lines.
How to use it — quick steps
- 01
Enter the text
Type or paste the text in the field above. Nothing is uploaded: the text stays in your browser.
- 02
Adjust the options
Pick the settings that fit your case; the defaults work for most people. Changes apply instantly.
- 03
Press "Trim lines"
Press "Trim lines" or Ctrl + Enter. The result appears instantly below the form. Results can be copied.
Key features of this tool
Nothing leaves your browser
The processing is plain JavaScript that runs on your device: the text you paste is never uploaded to our servers or to anyone else.
Instant results
Results appear the moment you press the button, even for long inputs, and every block has copy and download actions.
Works everywhere
No installation, no account and no limits: the tool works on desktop and mobile, in any modern browser, as often as you like.
Frequently asked questions
Does it remove spaces inside the line?
No, only at the edges. Use Remove Extra Spaces for inner whitespace.
Is the non-breaking space trimmed?
Yes, all Unicode whitespace is handled.
Are my files or data uploaded?
No. The tool is plain JavaScript that runs in your browser; the files or data you provide here are never uploaded to our servers.