Whitespace and Line Cleaner cleanup

Trim line ends, collapse repeated spaces, drop blank lines, convert tabs, and join lines, in any combination.

INPUTtext
0 lines 0 chars
1
OUTPUTcleaned
0 lines 0 chars
1
Tool Guide

What this tool does

Copied text arrives with whitespace you did not ask for. Copying from a PDF leaves indentation on every line, copying from a web page brings a stack of blank lines, and moving text between editors mixes tabs with spaces. None of it is ready to use as code or data.

This tool applies the cleanups you tick: trimming each line, collapsing runs of spaces into one, dropping blank lines, reducing consecutive blank lines to a single one, converting tabs to spaces, and joining every line into one.

Options apply in sequence, so combinations produce different results. The character count before and after is displayed so you can see exactly how much was removed.

When to use it

Use it to tidy text copied from a PDF or web page, to strip stray whitespace from a data file, to join a wrapped paragraph into one line, or to reset the indentation of a code snippet.

Input and output examples

Input indented line next sentence
Output indented line next sentence

Trimming plus blank line removal applied together.

Input words spread apart
Output words spread apart

With the collapse repeated spaces option enabled.

Notes and limitations

Do not use it on data where whitespace carries meaning. Python indentation is part of the syntax, YAML behaves the same way, and Markdown code blocks and tables depend on spacing; trimming line starts destroys all of them. Joining lines cannot be undone, so keep the original. Note too that while ordinary spaces and tabs are handled, special whitespace such as a non-breaking space copied from a web page can survive invisibly. If you suspect one, inspect the string with a character analysis tool.

Frequently asked questions

Can I use this on indentation-sensitive code?

Not recommended. Python, YAML, and similar formats treat indentation as syntax and will break.

Some whitespace seems to survive.

It may be a special character such as a non-breaking space. Check the byte count and character classes with a string inspection tool.

Copied