Trim Whitespace

Remove the spaces and tabs at the start and end of every line, which often sneak in when you copy from a spreadsheet, PDF or web page. Trim both ends, only the start, or only the end. Spaces between words are left alone.

What to do
Trim
Your text
Result
Lines in
0
Lines out
0
Blank lines in
0
Longest line
0

Everything runs in your browser. What you type never leaves this device.

Features

  • Trims every line separately

  • Both ends, start only or end only

  • Also removes non-breaking and zero-width spaces at the edges

  • Spaces between words are not touched

  • Copy or download the result

  • Runs in your browser: your text is never uploaded. Free, no signup

Where stray spaces cause trouble

Spreadsheet imports and lookups

"Delhi " with a trailing space does not match "Delhi" in VLOOKUP, filters or a database import.

Email and phone lists

A leading space can make a form or CRM reject an address or number.

Code and config

Trailing spaces show up as noise in Git diffs; trim the end of each line before committing.

Trim, collapse or clean

Which tool for which spaces

Indentation

Trimming the start removes indentation, which matters in code, YAML and poems. Choose End only to keep indentation and still clean trailing spaces.

Other line tools

Trim Whitespace - FAQ