LZW compression
Compress text into LZW dictionary codes, or decompress a code stream back to text.
LZW compression
LZW (Lempel-Ziv-Welch) is the dictionary-based compression algorithm behind classic GIF images and Unix compress. Paste a passage and this tool builds a dictionary of repeated substrings on the fly, replacing each repeated chunk with a shorter numeric code. Paste a code stream back in and it rebuilds the original text from the same rules. It's a good way to see dictionary compression working step by step, or to shrink small, repetitive chunks of text or data before storing them.
Direction switches between compressing (encode) and decompressing (decode); its swap button also moves the current output into the input so a result round-trips immediately. Input format and output format choose how the non-code side reads — plain text, a hex byte string, or comma-separated byte values — so you can compress raw hex dumps as easily as sentences. Keep zero-padding fixes every code or byte to a constant width for easy reading in a table; turning it off gives a shorter, variable-width result. Wrap output at N characters breaks a long result into fixed-width lines for copying.
Compression works on raw bytes, so accented letters, Cyrillic and emoji round-trip correctly through UTF-8. Short or non-repetitive input can come out longer than it went in, since a code needs enough bits to beat a single character — that's true of every real LZW implementation. The dictionary caps at 65,536 entries, matching production compressors, and the live tally reports bytes in, codes out, and how many entries it built.
Everything runs locally in your browser — nothing you paste here is uploaded. Copy the result, download it as a .txt file, or send it back into the input to try the reverse direction.