Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

Whitespace Remover API

Trim lines, collapse repeated spaces, expand tabs, join lines or remove all whitespace from text.

POST /api/v1/tools/whitespace-removerMCP whitespace_removerText & Writing

Clean up messy text: trim lines, collapse repeated spaces, convert tabs to spaces, join lines by removing line breaks, or strip every whitespace character.

Input

Send these as a JSON object. Unknown fields are rejected.

input
The text. (string, required)
trimLines
Remove spaces and tabs from the start and end of every line. (boolean, default true)
collapseSpaces
Replace runs of two or more spaces or tabs with a single space. (boolean, default true)
removeLineBreaks
Join all lines into one, separated by single spaces. (boolean, default false)
tabsToSpaces
Expand tabs to spaces, aligned to tab stops. (boolean, default false)
tabSize
Tab stop width used when expanding tabs. (integer, 1 to 16, default 4)
removeAll
Delete every whitespace character. Overrides the other options. (boolean, default false)
curl https://pithlab.com/api/v1/tools/whitespace-remover \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"input":"  Too    many   spaces  \n\tand a tab  "}'
Example response
{
  "ok": true,
  "result": {
    "output": "  Too    many   spaces  \n\tand a tab  ",
    "before": 37,
    "after": 37
  }
}