Decompress or compress LZ-String text (decompressFromEncodedURIComponent, Base64, UTF16), pasted or from files. Decodes TypeScript playground #code/ text.
Runs in your browser — your input is processed on this device and never uploaded.
Pick up to 5 UTF-8 text files of up to 100 MiB each, or paste text. Each file gets its own result. Decompress ignores line breaks, and in the uri form a space counts as +.
Decompress turns LZ-String text back into the original. Compress turns text into LZ-String text.
Which LZ-String form the text uses: uri (compressToEncodedURIComponent, the form used in links), base64 (compressToBase64) or utf16 (compressToUTF16). It is not guessed, so pick the one the text was made with.
Results appear here.
LZ-String is a JavaScript library that compresses text into other text. Web apps use it to fit their state into a link or into browser storage. The TypeScript playground, for example, puts your code in the link after #code/ this way.
This tool turns LZ-String text back into the original, or compresses text with LZ-String. Pick text files and get one file back for each, or paste the text. Ports of the library for other languages are often named LZString or lzstring.
Each form matches a pair of functions in the library:
For example, this text from after #code/ in a playground link:
MYewdgzgLgBA5gJwKZKgSzHAXDaCNwwC8MARABZIA2VIpA3AFCiQhVIB0tcAFIiukwBKJkA
comes back as the two lines of code it holds:
const greeting: string = "hello";
console.log(greeting);
Base64 makes text about a third longer. LZ-String compresses first, so long text with repeats, such as code or JSON, usually comes out shorter than it went in while staying safe for a link. Very short text can come out longer.
Reading it back is the common job: a share link or a stored value holds data you want to see, and the library's output is unreadable until it is decompressed.
If the text starts with H4sI, it is gzip data in Base64, not LZ-String. For plain Base64 or percent-encoded text, use the Base64 Encoder and Decoder or the URL Encoder and Decoder.
To compress a whole file for storage or download rather than for a link, a standard format such as Gzip is the safer choice, since every system can open it. In your own code, the lz-string package on npm does the same job as this tool.
pieroxy published LZ-String in 2013. It is a variant of LZW compression that writes its output in a chosen alphabet instead of raw bytes.
The utf16 form stores 15 bits in each character and adds 32 to every value, so it never produces control characters.
Older TypeScript playground links use #src= instead of #code/. That part is ordinary URL encoding, not LZ-String, so open it with the URL Encoder and Decoder.
LZ-String text can expand a great deal: a short string can stand for megabytes of output. Decompressing stops at 200 MiB of output, so one crafted link cannot grow without limit.
Warning
LZ-String is not encryption. Anyone with the link can read what it holds, so keep passwords and keys out of LZ-String links.
Find similar tools by category or tag.
Drag files here, or click to upload.
Up to 5 files, each run separately · 100 MB each · Required
No files selected.