Introduction
Zstandard is the compression algorithm Meta (Facebook) released in 2015 to fix the trade-off between gzip's speed and LZMA's ratio. It compresses about as well as gzip at the same speed, and at higher levels it approaches LZMA's ratio while decompressing 2-5x faster. It is now an RFC (8478) and ships in the Linux kernel, ZFS, Apple's file system, and Meta's own storage stack. This zstandard compress tool runs the algorithm in your browser with levels from 1 (fast) to 22 (ultra). No data leaves your device.
What this tool does
- Compresses text into Zstandard format (RFC 8478) with a configurable level from 1 (fastest) to 22 (ultra best ratio).
- Decompresses Zstandard data back to the original text, auto-detecting hex or base64 input.
- Outputs compressed data in both hex and base64 formats for easy copy-paste.
- Reports the compression ratio percentage so you can compare against gzip, Brotli, and LZMA.
- Uses the @bokuweb/zstd-wasm WebAssembly implementation compiled from the reference C library.
- Runs entirely client-side with no network requests.
How this tool works
In compress mode, the tool encodes your input as UTF-8 and passes it to the zstd-wasm compress function with the selected level. The WASM module loads asynchronously on first use (usually under a second), then stays cached in memory. The output is a raw Zstandard frame, displayed as both hex and base64. The compression ratio percentage compares the compressed size to the original UTF-8 byte count.
In decompress mode, the tool auto-detects whether your input is hex or base64, converts it to a Uint8Array, and passes it to the zstd-wasm decompress function. The output is the original text. Levels 1-19 are the standard range; levels 20-22 are ultra modes that require more memory and time but produce the smallest output.
How Zstandard compression works
Zstandard was designed by Yann Collet at Facebook (now Meta) and first released in 2015. It is specified in RFC 8478. The algorithm combines an LZ77-family dictionary stage with a Finite State Entropy (FSE) coder, which is a fast variant of arithmetic coding based on Asymmetric Numeral Systems (ANS).
The LZ77 stage finds repeated substrings within a sliding window. The default window is 8 MB, and Zstandard supports windows up to 128 MB for long-range matching, which helps on inputs with distant repetitions like log files or DNA sequences. The FSE stage replaces the Huffman coding used in DEFLATE with an arithmetic coder that can encode symbols with fractional-bit precision, similar to LZMA's range coder but faster.
The compression level (1-22) controls the dictionary search effort, the hash table size, and the number of strategies tried. Levels 1-3 are fast and suitable for real-time use. Levels 4-19 trade speed for ratio. Levels 20-22 are ultra modes that require --ultra flag in the command-line tool and use much more memory. Decompression speed is independent of the compression level, which is one of Zstandard's key advantages: you can compress once at level 22 and decompress millions of times at full speed.
Zstandard supports dictionaries for small inputs. A trained dictionary can dramatically improve compression on many small files (like JSON records or log lines) that would otherwise compress poorly because the window does not fill up. The Zstandard GitHub repository documents dictionary training. This tool does not support custom dictionaries; it uses the default empty dictionary.
How to use this tool
- Select mode: Compress or Decompress.
- For compression: set the level from 1 (fast) to 22 (ultra) using the slider.
- Type or paste text. Output shows hex, base64, and compression ratio.
- For decompression: paste hex or base64 Zstandard data. The tool auto-detects the format.
- Use the Swap button to switch between modes.
Real-world examples
Compressing API response payloads
A backend service returns large JSON payloads and wants to reduce bandwidth without slowing down the client. Zstandard level 3 compresses a 100 KB JSON response to about 12 KB in under 5 ms, which is fast enough for inline compression. The client decompresses in under 2 ms. This is faster than gzip at a similar ratio and much faster than LZMA.
Long-range matching on log files
A developer compresses a 5 MB log file that has repeated error messages spread minutes apart. gzip's 32 KB window misses those distant repetitions, but Zstandard with a larger window catches them. The result is 40% smaller than gzip on the same file. This is why ZFS added Zstandard as a dataset compression option.
Decompressing a .zst archive fragment
A developer inspecting a .tar.zst file extracts a single Zstandard frame as hex and pastes it into the decompress mode. The tool returns the original bytes, which they can inspect as a tar header or file content. This is useful for debugging Zstandard-packed artifacts without unpacking the whole archive.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| Zstandard (RFC 8478) | LZ77 + FSE, fast and strong | ZFS, Meta, Linux kernel, modern archives |
| DEFLATE (gzip) | LZ77 + Huffman, 32 KB window | HTTP Content-Encoding, PNG |
| Brotli | LZ77 + context modeling + dictionary | HTTPS Content-Encoding, web fonts |
| LZMA (xz) | LZ77 + range coder, large dictionary | 7z, xz, maximum ratio |
Limitations or considerations
Zstandard in the browser uses the @bokuweb/zstd-wasm package, which loads a WebAssembly binary on first use. The WASM module is about 100 KB. Levels 20-22 are ultra modes that use significantly more memory and CPU; for browser use, levels 1-19 are the practical range. This tool does not support custom dictionaries, which are the main way to get good ratios on many small inputs. For inputs under a few kilobytes without a dictionary, Zstandard's ratio will look similar to gzip because the window does not fill up.
Frequently asked questions
What compression level should I use?
Level 3 is the default and a good general-purpose choice. Levels 1-3 are fast enough for real-time use. Levels 4-19 trade speed for ratio. Levels 20-22 are ultra modes that require much more memory and time for marginal ratio gains. Decompression speed is the same regardless of compression level.
Is Zstandard better than gzip?
On most inputs, yes. Zstandard at level 3 is about as fast as gzip at level 6 and produces 10-15% smaller output. At higher levels Zstandard approaches LZMA's ratio while decompressing much faster. The main reason to prefer gzip is universal compatibility: every browser, server, and tool supports gzip, while Zstandard support is still growing.
Does Zstandard support custom dictionaries?
Yes, and this is one of its best features for small inputs. You can train a dictionary on a sample of your data and use it to compress many small files that would otherwise compress poorly. This tool does not support custom dictionaries; it uses the default empty dictionary. Use the zstd command-line tool with --train to build a dictionary.
Is Zstandard supported in browsers for Content-Encoding?
Not yet. As of 2026, no major browser supports Content-Encoding: zstd. Brotli and gzip are the supported options for HTTP compression. Zstandard is used for file archives, storage, and offline compression, not for live web delivery. The W3C and IETF have discussed adding it, but adoption has been slow.
Conclusion
Zstandard is the modern default when you need fast compression with a good ratio and very fast decompression. This tool runs it in your browser with levels 1 through 22 and outputs hex and base64. For web content delivery, use the Brotli or Gzip tools since browsers support those for Content-Encoding. For maximum ratio regardless of speed, try the LZMA tool.