⚙ Text Mechanic

Trim Lines

Remove leading whitespace, trailing whitespace, or both from every line in your text or code. Fast, private, client-side utility.

How to Use Trim Lines

  1. Paste Text: Paste your text or code snippet into the input box.
  2. Select Trim Mode: Choose Both Sides, Leading Only (left trim), or Trailing Only (right trim).
  3. Export Clean Text: Copy or download the trimmed text with zero extra edge spacing.

Key Features & Capabilities

  • Flexible Trimming: Trim leading whitespace, trailing whitespace, or both sides.
  • Code Safe: Remove trailing spaces from code without destroying required indentation.
  • Instant Live Updates: Transformations happen in real time as you type or adjust options.
  • 100% In-Browser Privacy: Your text never leaves your device or touches an external server.

Common Use Cases

  • Git Commit Cleanups: Strip trailing whitespace before staging code to prevent linter and git diff warnings.
  • Spreadsheet Data Cleaning: Clean pasted cells that contain accidental leading or trailing space characters.

Frequently Asked Questions

Will this affect spaces inside the line?
No, trim only removes spaces and tabs from the very beginning and very end of each line.
Does it remove tabs as well as spaces?
Yes, all standard whitespace characters including tabs and spaces at line boundaries are removed.

Related Text Utilities

Remove Empty Lines & Extra Spaces
Strip consecutive spaces, tabs, empty lines, and trailing whitespace
Remove Duplicate Lines
Identify and remove redundant lines with optional case sensitivity
Add Prefix & Suffix into Line
Append or prepend custom text or sequential index to every line
Add / Remove Line Breaks
Convert newlines to single line or add line breaks at specific character intervals