Trim Lines Online · Strip Edge Whitespace | DedupeLines
DedupeLines
Free · No signup Browser-local · zero upload · spaces, tabs, Unicode

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).

Input · 0 lines
output · 0 lines
Paste something on the left — results stream in here.

Or press Ctrl+Enter

Input lines 0
Blank lines 0
Lines trimmed 0
Output lines0

When to use this tool

guide
01 / CSV / export cleanup

Exports 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.

02 / Email list prep

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.

03 / Shell / log output

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.

04 / Copy-paste rescue

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
  1. 01

    Paste your text

    CSV exports, log output, copied-from-PDF paragraphs, anything with stray leading or trailing spaces.

  2. 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).

  3. 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

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.

Throughput
100K lines trimmed in ≈90 ms on a 2024 M3 MacBook Air

Single linear scan, one regex replace per line. Output is allocated once at the end, no per-line concatenation.

Threading
Web Worker for files ≥ 2 MB or ≥ 100K lines

Above the desktop threshold, the page stays interactive while the Worker handles the trim and delivers a .txt download.

Privacy & limits

what stays where

Everything 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

answered

Does 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.