Convertful
ImagePDFVideoUtilityBlog

Image Tools

  • Compress Image
  • Resize Image
  • Remove Background
  • HEIC to JPG
  • All Image Tools →

PDF Tools

  • Compress PDF
  • Merge PDFs
  • Split PDF
  • PDF to Images
  • All PDF Tools →

Video & Audio

  • Video to GIF
  • Compress Video
  • Trim Video
  • Extract Audio
  • All Video Tools →

Utility

  • QR Code Generator
  • JSON Formatter
  • Color Converter
  • All Utility Tools →
All processing happens in your browser. Your files never leave your device.
AboutBlogTermsPrivacyContact
© 2026 Convertful. All rights reserved.
HomeUtilityTrim Whitespace

Trim Whitespace

Trim, collapse, and clean whitespace from text. Free, private, runs in your browser.

100% private — your files never leave your browser. All processing happens locally on your device.

Trim Settings

Paste text above to clean up whitespace.

You might also need

Remove Empty LinesStrip blank lines or collapse consecutive empties
Remove Duplicate LinesDedupe lines with optional trimming and sorting
Sort LinesSort text lines alphabetically, numerically, or by length
Strip HTMLRemove HTML tags to extract plain text

What Counts as Whitespace?

More than you might think. Besides obvious spaces and tabs, text often carries invisible characters that cause subtle bugs: zero-width spaces from Word, byte-order marks (BOM) from saved files, soft hyphens from PDFs, left-to-right marks from localization systems, and inconsistent line endings (LF vs CRLF vs CR). This tool cleans all of them in one pass.

Trim, Collapse, and Normalize

Three distinct operations: trim removes leading and trailing whitespace on each line (or the whole text); collapse replaces runs of multiple spaces with a single space; normalize converts tabs to spaces (or removes them) and unifies line endings. Apply one or all of them — the tool composes them cleanly.

Why Invisible Characters Matter

Invisible Unicode characters break things in surprising ways: URLs silently fail to match, diffs show phantom changes, API requests get rejected with opaque errors, and code copy-pasted from blog posts throws syntax errors despite looking identical. Stripping zero-width, BOM, and directional marks eliminates an entire class of 'it works on my machine' problems.

Is My Text Safe?

Yes. Trimming is a pure string transformation running locally in your browser. Paste sensitive documents, proprietary data, or anything else — nothing is uploaded.

FAQ

Does it affect internal whitespace?

Only if you enable 'Collapse consecutive spaces'. By default only leading and trailing whitespace on each line is removed.

What does 'Remove invisible characters' do?

Strips zero-width space, BOM, soft hyphen, and other invisible Unicode marks that often get pasted from Word or Notion. These characters look clean but break diffs, URL encoding, and code paste.

Which line-ending should I use?

LF for macOS, Linux, and modern web. CRLF for legacy Windows workflows. CR for classic Mac (rarely needed). The tool always normalises first, so you get a consistent result regardless of the input mix.