Trim Text — Free Online Whitespace Trimmer

Remove leading and trailing whitespace from the whole text or from each line individually. 100% client-side — your text stays private.

Trim Text

Output

How to Use the Trim Text Tool

  1. Paste your text with unwanted edge whitespace.
  2. Choose to trim the whole block or each line separately.
  3. Optionally collapse internal spaces too.
  4. The output updates live.
  5. Click Copy to grab the trimmed text.

Why Trim Text

Leading and trailing spaces are invisible but cause real problems — they break string comparisons, misalign table columns, and add noise to databases. Trimming is the most basic, essential text cleanup, and doing it per-line preserves your paragraph structure while still cleaning every edge.

Frequently Asked Questions

Spaces, tabs, and newline characters at the very start and end of the targeted scope (whole text or each line).

No. Everything runs locally in your browser.

"Whole block" trims only the very start and end of the entire pasted text. "Each line" trims the start and end of every individual line, which is what you usually want for lists or code.

Use Cases

Form Validation

Strip edge spaces before saving user input.

List Cleanup

Trim each line of a pasted list uniformly.

Data Import

Clean field values before CSV or DB import.

Code Tidy

Remove stray indentation artifacts from snippets.