Text Minifier

Squeeze the wasted whitespace out of plain text and see exactly how much you saved.

Text
Minified text
Runs locally in your browser

About the Text Minifier

Text that has been copied between a PDF, an email and a spreadsheet arrives full of padding: double spaces after full stops, tabs used for alignment, trailing whitespace at the end of every line and stacks of blank lines where page breaks used to be. None of it carries meaning, all of it counts against a character limit, and it makes a diff impossible to read.

Three levels are available. Keeping lines collapses every run of spaces and tabs to a single space, trims both ends of each line and removes blank lines, which is the right setting for a list, a changelog or anything where line structure is the content. Joining onto one line goes further and produces a single paragraph, which is what a database column, a meta description or a CSV cell wants. The tightening level then removes the spaces that crept in before commas, full stops and closing brackets, and after opening ones, the artefacts that give scraped text its distinctive scruffy look.

Two extras sit alongside. Removing repeated lines compares them case insensitively after trimming, which catches the duplicate rows that appear when two exports are concatenated, while blank lines are left alone so structure is not lost. Replacing smart quotes swaps curly quotation marks, apostrophes and the single character ellipsis for their plain ASCII equivalents, which is what a terminal, a URL slug or an older parser needs.

The status line reports the before and after character counts and the percentage saved. For code use the language specific tools, such as CSS Minifier or JavaScript Minifier, since collapsing whitespace inside a string literal would change what the program does.

How to use

  1. Paste the text you want to tighten into the left pane.
  2. Choose How far to go, from keeping lines to a single tightened line.
  3. Tick Remove repeated lines when two lists have been merged.
  4. Read the saving in the status line, then copy or download the result.

Common questions

Does it change any words?
No. Only whitespace is touched, plus smart quotes if you tick that option. Every word and every number stays as it was.
Can I use it on source code?
Not safely. Whitespace inside strings and in languages such as Python is meaningful, so use a language specific minifier.
How does the duplicate check compare lines?
It trims each line and compares without regard to case, and it never removes blank lines.
What does the percentage in the status line mean?
The share of characters removed, measured against the original length, so 30% means the text is now 30% shorter.