Skip to content
hateitall

Trim Whitespace

Strip invisible spaces from the ends of lines before you paste text into code, a spreadsheet or a form.

Processed locallyIn: Text, TXT, CSVOut: Text

Loading tool…

How to use trim whitespace

  1. Paste your text.

  2. Choose both ends, start only or end only.

  3. Choose whether to drop blank lines at the top and bottom.

  4. Copy or download the trimmed text.

What this tool does

  • Trims spaces, tabs, no-break spaces and other Unicode spaces, plus the invisible byte order mark.
  • Trims each line separately and leaves spaces between words alone.
  • Reports how many characters were removed.

How the result is verified

Every line of the result is checked: none may start or end, on the side you chose, with any kind of space.

Frequently asked questions

What is the difference from Remove extra spaces?

Trim only touches the ends of lines. Remove extra spaces collapses repeated spaces between words. The text cleaner can do both at once.

Does it remove no-break spaces?

Yes. No-break spaces (common in text copied from web pages and Word) and other Unicode spaces at the ends of lines are removed too.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

Collapse runs of spaces and tabs into one space

Text · TXT→ TextLight on device

Delete blank lines, or keep one between paragraphs

Text · TXT→ TextLight on device

Hidden characters, spaces, blank lines and quotes cleaned in one pass

Text · TXT→ TextLight on device

Trim, dedupe, rename, split and convert columns in steps

CSV · TSV · Text→ CSVLight on device