Line Trimmer
Paste any text, choose trim mode (both sides, leading only, or trailing only), and get clean lines instantly.
Use the Line Trimmer
Input Text
Trim Mode
Result
0
Input lines
0
Output lines
0
Lines changed
Paste text on the left and click Trim Lines to begin.
Copied!
Summary
Line Trimmer removes leading and/or trailing whitespace from every line in a block of text. Choose to trim both sides, leading only, or trailing only, with an optional blank-line filter.
How it works
- JavaScript splits the input on newlines, applies the selected trim mode to each line using string methods, optionally filters blank results, then rejoins and displays the output — no server involved.
Use cases
- Clean up copy-pasted code that has inconsistent indentation.
- Strip trailing spaces from CSV or TSV data before import.
- Normalize log file entries with irregular leading whitespace.
- Prepare text for comparison by removing edge whitespace from each line.
Frequently Asked Questions
Last updated: 2026-05-23 · Reviewed by Nham Vu