Line Trimmer

Paste any text, choose trim mode (both sides, leading only, or trailing only), and get clean lines instantly.

Input Text

Trim Mode

Result

Paste text on the left and click Trim Lines to begin.

Copied!

Summary

Paste any text, choose trim mode (both sides, leading only, or trailing only), and get clean lines instantly.

How it works

  1. 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-06-09 · Reviewed by Nham Vu