Trim Whitespace from Lines
Removes spaces and tabs from the start, the end or both sides of each line.
Loading tool...
Runs in your browser. Nothing is sent anywhere.
When to use it
Good when data copied from Excel, a PDF or an email has invisible spaces at the start or end of lines that break matching, deduplication or imports.
Choose end of line only when working with code, YAML or indented lists, so leading indentation is kept. Spaces in the middle of a line are left alone.
How to use
- Paste your text into the left box.
- Choose which side to trim.
- Click Copy or Download.
Frequently asked questions
Is my text sent to a server?
No. The tool runs entirely in JavaScript in your browser, and the text you paste never leaves your device.
Related tools
Remove Extra SpacesMerges repeated spaces into one, removes spaces before commas and periods, and adds a space after commas, semicolons, colons, exclamation and question marks.Text CleanerMerges extra spaces, fixes spacing around punctuation, removes blank lines and invisible characters, and normalizes Vietnamese Unicode in one pass.
More Text tools
Shuffle Lines RandomlyShuffles the order of lines using your browser's random numbers, useful for making groups or setting a presentation order.Strip HTML TagsRemoves HTML tags, scripts and styles, decodes special characters, and keeps plain text with sensible line breaks.Remove Empty LinesRemoves every blank line, or line with only whitespace, from your text.Replace Smart Quotes with Straight QuotesConverts curly double quotes, curly single quotes, long dashes and ellipsis characters into plain typed characters, avoiding errors when pasting into code.Reverse Line OrderFlips the order of the lines so the last line comes first, handy for reversing a list or a log.Add Line NumbersAdds a sequence number at the start of each line in styles like 1. 1) 01, skips blank lines, or removes existing line numbers.
See all text tools