Related tools
Why use a text trimmer?
Strip accidental spaces from spreadsheets, tidy pasted email, or normalize drafts before code, CSV, or CMS fields—without installing an editor.
Benefits
- Line-aware trims: leading, trailing, or both—per row.
- One-click collapse: “trim all” for dense single-line cleanup.
- Blank lines: remove empty rows fast.
- Live: see output immediately.
- Private: nothing leaves the browser.
How it works
Modes use simple string rules on plain text: per-line trimming with trim or regex, global whitespace collapse for “trim all”, or line filtering for empty lines.
Features
- Trim both: `.trim()` on each line.
- Trim start/end: only leading or only trailing spaces per line.
- Trim all: `/\s+/g` → single spaces, then trim.
- Empty lines: skip lines with no visible characters.
- Copy: take the cleaned textarea output.
When to use
Before import, before linting copy, or when Markdown/HTML spacing from paste is wrong for plain text.
Ideal use cases
- CSV-ish rows: trim cells pasted as lines.
- Logs: drop blank separator lines.
- User input: remove accidental spaces at ends.
- Dense blobs: one-line summary via trim all.
- Quick QA: visual check before scripts.
Facts
Behavior notes.
Key points
- Per-line modes keep newline characters between non-empty lines.
- Trim all turns line breaks into spaces—use sparingly for multi-paragraph text.
- Indents at line start are removed when you trim start or both.
- Very large inputs may hit browser memory limits.
- Rich formatting from Word or HTML is not preserved.
Best practices
Avoid surprises.
Quality considerations
- For code or YAML, review output—trimming can change meaning.
- For poetry or layout-sensitive text, avoid trim all.
- Preview before pasting into production systems.
- Chain steps manually: paste output and pick another mode if needed.
- Keep a backup of the original if trimming is destructive.
When not to use
- When indentation must be preserved on every line.
- When you need Unicode trim rules beyond ECMAScript whitespace.
- When only a database-backed workflow should normalize fields.
Limitations and compatibility
Plain text; one mode at a time; copy only. Requires JavaScript.
Text trimming runs fully in your browser with no server upload; cleaned output updates instantly when you switch trim modes.
Frequently asked questions
Is the text trimmer free?
Yes. Trimming runs in your browser. No registration or upload.
What do “trim both / start / end” do?
They work line by line: remove leading whitespace, trailing whitespace, or both on each line. Line breaks between lines are kept (except in “trim all”).
What does “trim all” do?
It replaces every run of whitespace (spaces, tabs, newlines, etc.) with a single space, then trims the whole string. Paragraph structure is not preserved—use other modes if you need separate lines.
What does “remove empty lines” do?
It drops lines that are empty or only spaces/tabs after trimming each line internally for the empty check.
Can I combine modes at once?
No. Pick one mode at a time. Run another pass by pasting the result back in if you need multiple steps.
Is my text secure?
Yes. All processing happens on your device.