Whitespace cleaner
Clean unnecessary horizontal whitespace.
How it works
Choose whether to trim ASCII spaces and tabs at line edges, collapse horizontal runs to a single space, or remove empty and ASCII space/tab-only lines everywhere or only at text boundaries. Both trimming and collapsing are enabled by default. Other Unicode whitespace is preserved.
Copy cleaning summary
Use Copy text cleaning summary to copy the displayed output code-point count as tab-separated Metric and Value columns, without copying the cleaned text. With the default options, Red apple with extra spaces at the edges and three spaces between words becomes Red apple (9 output code points).
Choose what to clean
For a line containing two leading spaces, Red apple and two trailing spaces, trimming alone removes the edge spaces but keeps the three spaces between words. Collapsing alone changes each run of ASCII spaces or tabs to one space, including runs at the edges. Both options together produce Red apple. Disable both to leave horizontal spacing unchanged.
Blank lines and line endings
CRLF and CR become LF. A terminal newline contributes an empty final segment. By default all segments remain; Remove blank lines discards every empty or ASCII space/tab-only segment, including the final one. Other Unicode whitespace, such as nonbreaking spaces, is not trimmed, collapsed or considered blank.
Keep paragraph spacing
Enable Remove blank lines at text boundaries to discard only leading and trailing empty or ASCII space/tab-only line elements, including the final empty element from a terminal newline. Eligibility is checked before trimming or collapsing. For example, a blank line before First paragraph. and after Second paragraph. is removed, while the blank line between those paragraphs stays. If every line is eligible, the result is empty. Remove blank lines takes precedence when both options are enabled. No final newline is added. Source limit: 50,000 UTF-16 units; the result cannot grow. Processing stays in your browser.
Related text tools
Use Remove line breaks to join or split text, Text line filter to retain matching lines, or Remove duplicate lines to deduplicate a list.