Trim Text removes extra spaces from the beginning and end of every line. Paste your lines, click the button and copy the clean result. It is free and runs in your browser.
apple banana cherry
apple banana cherry
Bookmark: press Ctrl+D (Windows) or Cmd+D (Mac) to save this tool.
This tool trims each line of your text. It removes the extra spaces and tabs at the beginning and at the end of every line, so all your lines start and end with a real character.
The words in a line and the spaces between them are not changed. Empty lines stay where they are, and a line that only has spaces becomes an empty line.
Use it to clean up text copied from a PDF, an email or a web page, or a list where the lines have uneven indents.
Each example shows the lines before and after trimming. Leading and trailing spaces are removed, spaces between words are kept.
| Setting | Before | After |
|---|---|---|
| Spaces at both ends | apple banana | apple banana |
| Spaces between words stay | hello world | hello world |
| Tabs are trimmed too | name | name |
| Line with only spaces | a
b | a b |
| Trim the start only | keep end | keep end |
| Trim the end only | keep start | keep start |
| Already clean | one two | one two |
Cleaning lists copied from emails, PDFs and web pages, fixing uneven indents, and getting lines ready for sorting, comparing or importing into a spreadsheet.
Trimming only touches the edges of each line. Spaces between words stay, and empty lines stay. Use Undo right after if the result is not what you wanted.
To also fix the spaces between words, try Remove Extra Spaces. To delete blank lines, try Remove Empty Lines.
It trims each line of your text. It removes extra spaces and tabs from the beginning and the end of every line and leaves the words and the spaces between them as they are.
Type or paste your lines, then click Trim Text. The trimmed lines replace the text in the box. Click Copy to use them, or Undo to go back.
No. Only the spaces at the start and the end of each line are removed. Spaces between words stay. To change those, use Remove Extra Spaces.
Yes. Untick Trim the start of each line or Trim the end of each line, then click Trim Text. Both are ticked by default.
Yes. Tabs, non-breaking spaces and other blank characters at the edges of a line are removed along with normal spaces.
Empty lines stay in place. A line that only has spaces becomes an empty line. To delete empty lines, use Remove Empty Lines.
Yes. It is free, needs no account and runs in your browser, so your text is not uploaded to a server.
Last updated: 2 November 2026