Text & Regex
Whitespace Cleaner
Paste messy text and get clean text back. Strip trailing and leading whitespace, expand or convert tabs, collapse repeated spaces and blank lines, and pick a consistent line ending. Copy or download the result — your text never leaves the page.
Cleanup options
liveInput
originalPaste any text. Line endings are detected automatically when set to “Keep as typed”.
Output
cleanedRead-only result, updated as you type. Copy or download it with the buttons above.
How it works
Each line is cleaned in order: tabs are expanded first when selected, then trailing and leading whitespace are removed, repeated spaces are collapsed, and finally spaces are converted to tabs for indentation. Blank lines are treated as empty or whitespace-only lines; you can keep them, collapse each run to a single blank line, or remove them all. Leading and trailing blank lines can be trimmed automatically. Everything runs locally in your browser — no text is uploaded.