Trim Whitespace
Remove leading and trailing whitespace from every line while leaving the characters between the ends of each line unchanged.
What this tool actually changes
Each input line is passed through JavaScript String.trim(). This removes whitespace at both ends, including common spaces, tabs, and other Unicode whitespace recognized by the browser.
Edge cases to know
Indentation is removed. That is useful for cleaning pasted lists but may be undesirable for source code where indentation is meaningful. Empty lines remain empty.
Example
Input:
alpha
beta
gamma
Output:
alpha
beta
gammaGood use cases
Pasted lists, CSV-like data, configuration values, copied documentation, and text where accidental indentation or trailing spaces should be removed.
Workflow tip
Choose the operation that matches your intent. If whitespace is causing unexpected duplicates, normalize it before deduplicating rather than assuming the duplicate operation should ignore formatting.
Frequently asked questions
Does it preserve indentation?
No. Leading whitespace is removed. Use this carefully with source code.
What whitespace is removed?
JavaScript trim() removes whitespace recognized by the browser at both ends of each line.
Does it remove blank lines?
No. Blank lines remain; use Remove Empty Lines if you want them removed.