Skip to main content

Whitespace Trimmer

Collapse repeated tabs or spaces down to a single one, or remove them entirely, anywhere in a block of text. Runs entirely in your browser.

Input

Output

Whitespace-removed Text
Was this helpful?

Guides

Clean up messy spacing in text — collapse repeated spaces or tabs down to a single one, or strip them out completely. Handy for text pasted from a spreadsheet or PDF where columns get padded with runs of spaces, or code with inconsistent tab indentation.

How to use it

  1. Paste your text into the input box.
  2. Choose what counts as Considered As Whitespace — Tab, Space, or Any Space or Tab.
  3. Choose whether to only collapse duplicates, or remove the character entirely.
  4. Copy or download the result.

Settings

  • Considered As Whitespace — which character the tool acts on: Tab, Space (the default), or Any Space or Tab (treats runs of either as one unit).
  • Remove Duplicated Whitespaces Only — a run of two or more of the chosen character becomes exactly one (a single character stays untouched).
  • Remove All Whitespaces — every occurrence of the chosen character is deleted, even single ones.

Only the character you select is affected — choosing Tab leaves spaces exactly as they are, and vice versa, unless you choose Any Space or Tab.

Privacy

Everything runs entirely in your browser. Your text is never uploaded to a server.

whitespacetrimspacestabstext cleanupformatter

Use it from code

From 3 credits per call

REST API

curl -X POST https://api.iotools.cloud/v1/tool/whitespace-trimmer \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "originalText": "Hello    World\nHow   are    you?",
    "consideredAsWhitespace": " ",
    "removeWhitespaces": "duplicate-whitespaces"
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `whitespace-trimmer` tool (Whitespace Trimmer) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.