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.

Runs in your browser v1.0.0

Cleanup options

live
4
Whitespace

Blank lines include empty lines and lines that contain only spaces or tabs. Tab width is used when converting tabs to spaces or spaces to tabs; it is disabled while tabs are kept as-is.

Input

original

Paste any text. Line endings are detected automatically when set to “Keep as typed”.

Output

cleaned

Read-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.