Loading LZ4 to Base64 Converter...
Please wait a moment

How to Use the LZ4 to Base64 Converter

Step 1

Input Your Data

Start with the data you want to compress. The page combines LZ4 compression with Base64 encoding in one step, which is handy when compressed data has to live in a database text column, an API body or a JSON field. You can:

•
Paste directly: Copy your text or data and paste it into the input editor
•
Upload a file: Pick any file, text or binary. Binary files are compressed byte for byte and not shown in the editor
•
Try the sample: Click "Sample" to load a small JSON document and see the output

Example: Input JSON Data

A short JSON document before compression and encoding:

{
  "user": {
    "id": "USR-98765",
    "name": "Alex Chen"
  }
}
Step 2

Automatic LZ4 Compression

There is no button to press. Half a second after you stop typing, the page:

•
Compresses with LZ4: Writes a standard LZ4 frame, the format the lz4 command-line tool reads
•
Encodes to Base64: Turns the binary frame into plain text that is safe to paste anywhere
•
Shows the sizes: The badge shows the original size, the compressed size and how much was saved, or how much it grew

Example: Base64 Encoded Output

This is the output for the Step 1 example:

BCJNGEBw30IAAIB7CiAgInVzZXIiOiB7CiAgICAiaWQiOiAiVVNSLTk4NzY1IiwKICAgICJuYW1lIjogIkFsZXggQ2hlbiIKICB9Cn0AAAAA

The 66 bytes of JSON became an 81-byte LZ4 frame, 108 characters once Base64-encoded. A snippet this short has nothing to compress and the frame header makes it bigger; longer files with repeated keys and values shrink a lot.

Step 3

Copy or Download the Base64

Take the Base64 string wherever it needs to go:

•
Copy to clipboard: Copies the Base64 for the current input, even if you are still typing
•
Download as file: Saves the Base64 text as a .lz4.base64 file, named after your upload when you used one
•
Send it over HTTP: Drop it into an HTTP request body or a text column and decode it on the other side

Frequently Asked Questions

What exactly does this page produce?

A standard LZ4 frame, the same format the lz4 command-line tool writes and reads, encoded as Base64. The frame starts with the LZ4 magic number, so the Base64 always begins with "BCJNGE". The reference liblz4 library and the lz4 tool read it back to exactly the bytes you put in.

Why would I want LZ4 data as Base64?

LZ4 output is binary, and raw bytes break in JSON strings, query parameters, environment variables and most text columns. Base64 rewrites them using only letters, digits, + and /, so the compressed data can sit in any text field and come back byte for byte on the other side.

Will the Base64 be shorter than my original text?

Only when the data repeats itself a lot. An LZ4 frame adds at least 15 bytes of header and end marker, and Base64 makes the result about a third longer, so short snippets grow: the 66-byte example on this page becomes an 81-byte frame and 108 characters of Base64. Larger files with repeated keys shrink properly; 200 similar JSON lines (9,689 bytes) came out as a 1,065-byte frame. The badge above the output shows the real sizes for whatever you enter.

How do I get the original data back?

Decode the Base64, then decompress the frame. In Python that is lz4.frame.decompress(base64.b64decode(s)); on the command line, base64 -d file.lz4.base64 | lz4 -dc > original. You can also paste the string into our Base64 to LZ4 decoder. Note that this is the frame format, not a raw LZ4 block, so code that calls a block-level decompress function will not read it.

Can I upload a file, including a binary one?

Yes, any file. Text files appear in the editor; images and other binary files don't, but they are compressed from their raw bytes, BOM and Windows line endings included, so decoding later gives back the identical file. Download saves the Base64 text as a .lz4.base64 file named after your upload. An empty file is refused and your input stays as it was.

How is this different from the LZ4 compression tool?

Both write the same LZ4 frame. This page is about the text form: Copy and Download give you the Base64 string you see. The LZ4 compression tool downloads the raw .lz4 bytes instead, which is what you want for a file on disk.

Does my data leave the browser?

No. Compression and Base64 encoding run in your browser. Nothing you paste or upload is sent to our server, and nothing is kept: reload the page and the editor starts empty.