Remove Extra Spaces, Tabs and Line Breaks
Trim, collapse and strip spaces, tabs and line breaks.
0 → 0 characters
Use via API
Trim lines, collapse repeated spaces, expand tabs, join lines or remove all whitespace from text. Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/whitespace-remover
curl https://pithlab.com/api/v1/tools/whitespace-remover \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"input":" Too many spaces \n\tand a tab "}'About the Whitespace Remover
Clean up messy text: trim lines, collapse repeated spaces, convert tabs to spaces, join lines by removing line breaks, or strip every whitespace character.
How to use the Whitespace Remover
- Paste your text into the input box.
- Choose what to clean: trim each line, collapse repeated spaces, convert tabs to spaces, or remove line breaks.
- Tick Remove all whitespace to delete every space, tab and line break, for example to tidy a copied number or code.
- The result updates as you type and shows the length before and after. Copy or download it.
Examples
Input
Hello world second line
Output
Hello world second line
Input
This sentence was broken across lines.
Output
This sentence was broken across lines.
Input
GB29 NWBK 6016 1331 9268 19
Output
GB29NWBK60161331926819
Frequently asked questions
Which characters count as whitespace?
Spaces, tabs, line breaks and Unicode spaces such as the non-breaking space and em space. Collapsing replaces any run of two or more spaces or tabs with one ordinary space.
How does tab conversion work?
Tabs are expanded to the next tab stop, every 2, 4 or 8 columns, just like a code editor, so text that was aligned with tabs stays aligned with spaces.
What happens to blank lines when I remove line breaks?
Blank lines are dropped and the remaining lines are joined with a single space, so words from neighbouring lines don't run together.