Tooleux

LZMA Compress

LZMA-Alone (2)

Compress text with LZMA-Alone. Output is Base64 or hex.

Runs in your browser. Nothing leaves your device.
Compress text with LZMA-Alone in your browser. Free, offline, runs entirely client-side. Read more Show less

What is LZMA-Alone?

LZMA-Alone is the raw LZMA1 compressed stream with no container. It is specified in the LZMA SDK by Igor Pavlov (the author of 7-Zip). Unlike XZ, it has no header, no footer, no checksum, and no stream index - it is just the compressed bytes.

LZMA-Alone appears in embedded systems, some firmware formats, and as a building block inside other containers. When a tool says "LZMA" without qualifying, it usually means LZMA-Alone. When it says "XZ", it means the XZ container format.

How to use

Type or paste text, choose a compression level, and press Compress. The tool produces a Base64 or hex representation of the compressed stream.

To decompress LZMA-Alone data, use the LZMA Decompress tool. Note that LZMA-Alone has no magic bytes, so the decompressor cannot detect the format from the data alone - you must choose the right tool.

Compression levels

LZMA supports preset levels 0 to 9. Higher levels use a larger dictionary and more search effort, producing smaller output at the cost of CPU time and memory. Default for most tools is 6. Maximum compression is 9.

FAQ

LZMA-Alone vs XZ

XZ is LZMA2 in a container with magic bytes, checksums, and a stream index. LZMA-Alone is raw LZMA1 with no framing at all. XZ is safer (checksums catch corruption) and easier to detect (magic bytes). LZMA-Alone is smaller by a few bytes and simpler to embed in other formats.

Why does the output not start with a magic number?

Because LZMA-Alone has none. That is the format - it is designed to be used inside a container that provides the framing. If you need a detectable magic number, use XZ.

Can I tell from the data whether it is LZMA-Alone?

Not reliably. The first byte is a properties byte that must be 0x5D for the standard LZMA1 configuration (lc=3, lp=0, pb=2), and the next 4 bytes are the dictionary size in little-endian. If those bytes look plausible, it might be LZMA-Alone. But other formats could coincidentally match.

Is LZMA-Alone still used?

Yes, in embedded firmware, some game assets, and as a component inside 7z, XZ, and other archives. It has been largely superseded by LZMA2 for new formats, but legacy data uses it heavily.

Command line equivalent
# Compress with the xz command (raw LZMA1)
xz --format=lzma -zk9 input.txt

# Decompress
xz --format=lzma -d input.txt.lzma

# Python
python3 -c '
import lzma
data = b"hello" * 100
ct = lzma.compress(data, format=lzma.FORMAT_ALONE, preset=9)
import base64
print(base64.b64encode(ct).decode())
'

# 7-Zip
7z a -tlzma archive.lzma input.txt
Loads a test value into the form
Input
Compressed (LZMA)