Clean whitespace
Remove trailing spaces, optionally collapse spaces and tabs, and limit consecutive blank lines.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Tidy pasted text with three separate options. By default, line-end spaces and tabs are removed, repeated spaces inside lines are left alone, and at most one blank line is kept in each run. Choose your settings, then run the tool and compare the spacing.
How to use this tool
- Paste text into “Text”, or load the example to try it.
- Set the two checkboxes and a whole-number blank-line maximum, then select “Clean whitespace”.
- Compare paragraph gaps and indentation. Use “Copy result” or download result.txt to keep the complete text.
Supported inputs and limits
Paste up to 1 MiB (1,048,576 UTF-8 bytes), including spaces and line breaks. There is no file import. Empty input is allowed and can produce an empty result.txt file.
Trailing cleanup removes tabs and Unicode space separators at line ends. Collapsing replaces runs of ordinary spaces and tabs with one space, including indentation. Blank-only lines are treated as empty even when both checkboxes are off; the blank-line limit applies at the start, between text lines and at the end.
Set the blank-line maximum to a whole number from 0 to 100; leaving it blank uses 1. Zero removes blank-only lines and keeps breaks between the remaining text lines. Input containing only whitespace gives an empty result at 0 or 1; higher values can retain line breaks.
Worked example
Example input
A B
Example options
{}Example output
A B
When something does not work
Keep the original text. Turn off space/tab collapsing if indentation changes, or raise the blank-line maximum if you need larger gaps. Use a whole number from 0 to 100 and shorten input above 1 MiB. Edits, cancellation or a form validation error may leave the previous result visible; an actual processing failure clears it. Run again before using a retained result.
Frequently asked questions
Where is my pasted text processed?
The tool runs locally in your browser. Switching tools can keep a temporary workspace in the same tab, within cache limits; refreshing or closing the tab clears it. Keep your original text and save any result you need.
What should I check in this result?
Check indentation, alignment and Markdown line breaks: collapsing spaces and tabs also changes leading indentation, and trailing-space removal can remove the two spaces used for a Markdown hard break. This tool caps blank-line runs rather than joining wrapped text into paragraphs. It uses the first CRLF, CR or LF style it receives; pasting may normalize line breaks before processing.
Why does the preview show only part of a long result?
The preview shows at most 4,000 Unicode code points. “Copy result” and result.txt contain the complete cleaned text. “Output details” contains JSON with input and output code-point counts.
Documentation & further reading
Related tools
TXT to UTF-8
Read a TXT file with the right source encoding and save it as UTF-8.
Merge TXT files
Combine TXT files in your chosen order and save one UTF-8 text file.
Word counter
Words, characters, and paragraphs at a glance.
Case converter
Change pasted text to uppercase, lowercase or simple capitalized forms.