🗜

Text Compressor

Free online text compressor. Multiple modes: strip all whitespace, merge blank lines, collapse to single line, compress SQL, or minify CSS/JS. Shows compression ratio and saved characters in real time. All processing is done locally in your browser.

Compression Mode

Input
Output

What is the difference between Strip all whitespace and Collapse to one line?

Strip all whitespace removes every space, tab and newline, producing a completely gap-free string — useful for pre-processing before Base64 encoding. Collapse to one line only removes newlines, joining lines with a space so words remain separated and the result stays readable.

Will Compress SQL break my queries?

No. SQL mode collapses consecutive whitespace (spaces, tabs, newlines) into a single space and strips -- line comments. All keywords, table names, column names and punctuation are preserved, so the compressed SQL can be executed directly.

Is the CSS/JS mode safe for production?

It works well for straightforward CSS. The mode strips /* */ block comments and excess whitespace. For complex JavaScript (string literals, regex, template literals), use a dedicated tool like Terser or esbuild to avoid accidentally removing meaningful whitespace.

How is the compression ratio calculated?

Ratio = (original chars − compressed chars) / original chars × 100%. For example, 1000 chars compressed to 600 chars gives a 40% ratio, saving 400 characters.

When should I use Merge blank lines?

Use it to clean up text pasted from web pages, PDFs or editors that contain excessive blank lines. The mode collapses three or more consecutive blank lines into a single blank line, preserving paragraph structure without touching the actual content.

Does the tool upload my text to a server?

No. All compression is performed locally in your browser. Your text is never sent to any server, so it is safe to use with sensitive content such as SQL queries, configuration files or private documents.