Chars before
--
Free · Instant · No signup
Collapse runs of spaces and tabs to one space and trim the edges of the text.
Page updated 2026-09-04.
Chars before
--
Chars after
--
'too many\t\tspaces here ' (27 characters, with multiple consecutive spaces and a tab character) cleans to 'too many spaces here' (20 characters) -- every run of whitespace (regardless of how many spaces or tabs it contained) collapses to exactly one space, and trailing whitespace at the end is trimmed entirely.
The 7-character reduction here (27 to 20) comes from collapsing the extra spaces between words plus trimming the trailing spaces -- a common source of invisible bloat in text that's been copy-pasted from a source with inconsistent spacing, like a PDF or a spreadsheet cell.
Tabs specifically get converted to a single space rather than being preserved as a tab character or expanded to multiple spaces -- this normalizes mixed tab-and-space text into consistent, predictable single-space formatting.
Newlines stay unless you collapse them. Tabs become a single space. With the 'also collapse newlines to spaces' option left off (as in this example), actual line breaks in the text are preserved -- only horizontal whitespace (spaces and tabs) within a line gets cleaned, which matters if you want to fix messy spacing without destroying intentional paragraph breaks.
Turning that option on would flatten all line breaks into spaces too, useful specifically when you want to convert a multi-line block of text into one continuous paragraph while also cleaning up spacing -- a combined operation some other tools (like the line joiner) handle separately.
This cleans horizontal whitespace only -- it doesn't remove or normalize other invisible characters like zero-width spaces or non-breaking spaces, which can look identical to a normal space but behave differently and might need separate handling if pasted in from certain sources.
If the actual goal is combining multiple lines into one string (a related but different transformation than cleaning spacing within existing lines), the Line Break / Newline Joiner is the more direct tool.
For counting characters in text before or after cleanup, the Character Count (No Spaces) gives both with-space and without-space counts.
The multiple consecutive spaces between words each collapsed down to a single space, and the trailing whitespace at the end of the text was trimmed entirely -- together accounting for the 7-character reduction.
Newlines stay unless you collapse them. Tabs become a single space. Tabs are converted to a single space, the same as any other run of whitespace, rather than being preserved as a distinct tab character or expanded into multiple spaces.
Not by default. Newlines stay unless you collapse them. Tabs become a single space. Line breaks are preserved unless you specifically enable the 'also collapse newlines to spaces' option, which lets you clean spacing without destroying intentional paragraph structure.
This cleaner is built for standard horizontal whitespace (regular spaces and tabs). Non-breaking spaces or zero-width characters, which can look identical to a normal space but behave differently, aren't necessarily normalized by this specific cleanup.
Commonly from copy-pasting text out of a PDF, a spreadsheet cell, or a source with inconsistent formatting -- these sources often introduce extra spaces, tabs, or trailing whitespace that isn't visible until the text is pasted somewhere that reveals it.
Dice Roller & Probability Distribution Simulator Roll n dice with a chosen face count, show faces and total, plus the theoretical mean.
Military Time (24-Hour) Converter Convert a 12-hour hour and minute plus AM/PM into 24-hour time, or the reverse.
Electric Bill & Appliance Wattage Cost Calculator kWh and cost from appliance watts, hours per day, days, and the kWh rate.
Pregnancy Due Date Calculator (Naegele's Rule) Due date as LMP plus 280 days, plus gestational weeks from Date.now().