Trim lines, online
Paste any text list. Every line gets its leading and trailing whitespace stripped — spaces, tabs, even invisible Unicode whitespace. By default we also drop the now-empty rows; toggle that off if you want the whitespace lines kept (they will just appear blank).
Or press Ctrl+Enter
When to use this tool
guideExports from CRM, Sheets, or any pipeline often arrive with leading spaces from indenting or trailing whitespace from quoting. One trim and the next tool downstream sees clean values.
Email lists copied from documents almost always carry " [email protected] " spaces. Trim them all in one paste before importing — many mail-platform validators reject padded addresses.
Aligned columns from `awk`, `ps`, `df`, or Docker logs usually pad fields with spaces. Trim by line so they diff cleanly, grep cleanly, and paste straight into a spreadsheet column.
Copying from a wrapped paragraph or PDF often pastes invisible Unicode spaces (NBSP, en-space, etc.) that break later regex / equality matches. Trim once, save the debugging.
How it works
three steps-
01
Paste your text
CSV exports, log output, copied-from-PDF paragraphs, anything with stray leading or trailing spaces.
-
02
Decide on empty-line behaviour
On by default — if trimming a line makes it empty, that line is dropped. Toggle off to preserve the original line count (now-empty lines become visually blank).
-
03
Hit Run
Every line gets its leading and trailing whitespace stripped. Spaces, tabs, and invisible Unicode whitespace (NBSP, en-space, em-space, ideographic space) all go.
Under the hood
engine notes- What gets trimmed
- /^\s+|\s+$/ on each line
- Throughput
- 100K lines trimmed in ≈90 ms on a 2024 M3 MacBook Air
- Threading
- Web Worker for files ≥ 2 MB or ≥ 100K lines
JavaScript \s covers tab, space, NBSP (U+00A0), en-space (U+2002), em-space (U+2003), thin space (U+2009), ideographic space (U+3000). Zero-width space (U+200B) is not in \s and stays.
Single linear scan, one regex replace per line. Output is allocated once at the end, no per-line concatenation.
Above the desktop threshold, the page stays interactive while the Worker handles the trim and delivers a .txt download.
Privacy & limits
what stays whereEverything runs in your browser tab. Your text is never uploaded; the whitespace strip happens against the string in memory and never leaves your machine. 80 MB hard cap per run.
Frequently asked
answeredDoes this remove all whitespace or just leading and trailing?
Only leading and trailing. Whitespace inside a line — between words, in tab-separated values — is preserved. If you need to collapse internal whitespace too, use the regex extractor with a custom replacement pattern.
Which characters count as whitespace?
JavaScript's \s character class: ASCII space, tab, newline, vertical tab, form feed, plus Unicode whitespace including NBSP (U+00A0), en-space (U+2002), em-space (U+2003), thin space (U+2009), ideographic space (U+3000), and friends. Note: zero-width space (U+200B) is not part of \s and is not trimmed.
Does it drop lines that become empty after trimming?
By default, yes — the "remove empty lines" toggle is on. Turn it off if you want every original line preserved (a trimmed-to-empty line becomes a blank row in the output, keeping line numbers aligned).
Is my text sent to a server?
No. The trim runs entirely in your browser. The line never leaves your machine — there is no upload step, and the analytics layer is blind to your input.