Cleanup & Extraction

Trim Whitespace from Lines Online

Normalize copied lines by trimming leading and trailing spaces before the next tool in your workflow.

Quick answer

This page trims leading and trailing whitespace from each line while preserving the line order.

It is useful before dedupe, comparison, quoting, slugifying, or turning copied exports into clean lists.

Trim whitespace
Advanced settings
InputText with uneven spacing
OutputWhitespace-trimmed lines
ModeTrim whitespace
Total lines0
Changed lines0
Empty lines0
Output lines0
Input chars0
Output chars0
Delta0

How to use

  1. Paste the text with uneven spacing into the input box.
  2. Optionally remove empty rows after trimming.
  3. Copy the normalized output.

Common questions this page answers

  • How do I trim whitespace from each line online?
  • How do I remove leading and trailing spaces from copied values?
  • How do I normalize text before deduping or comparing it?

Example input and output

Input

  alpha  
 beta

gamma   

Trimmed output

alpha
beta

gamma

FAQ

Does it keep blank lines?

Yes by default. Enable skip-empty if you want blank rows removed after trimming.

Will it change the order of the lines?

No. It only trims whitespace around each line.

What tool should I use next?

Trim first, then dedupe, compare, quote, or join the cleaned values.

Ready.