Introduction
Lzip compresses a single file with LZMA, the method used by
xz and 7-Zip, inside a deliberately small and simple
container designed for long-term archiving. Antonio Díaz Díaz released
lzip in 2008. Some GNU projects publish their
source code as .tar.lz files alongside other formats.
Structure
An lzip file is one or more members one after another. Numbers are little-endian.
0MagicLZIP4 bytes4Version 1 (0 in old files)1 byte5Dictionary size coded in one byte1 byte6LZMA data ending with an end-of-stream markervaries…Trailer CRC-32 of the data, its size, and the size of the whole member20 bytes
The sizes in the trailer let a tool walk a file backwards, member by member, and find damaged parts, which is the point of the design. The member page gives every field.
In the explorer
Drop an .lz file on this site. The structure tree shows every member: the ID
string, version and coded dictionary size (decoded to its size), the LZMA stream (the range
coder’s start and the range-coded symbols, counted by kind: literals, matches, repeats, short
repeats and the end marker) and the trailer with its CRC-32, data size and member size. Each
of those three is checked on its own, as is the dictionary size against the farthest match.
Members are found from the member sizes in the trailers, read from the end of the file; a
file with trailing data or a damaged trailer is followed member by member instead. Every member
is decoded to its end when the file is opened, whatever its size, and its CRC-32, data size and
member size are checked over all of it. The bytes after a member are told apart by lzip’s own
rules: bytes that match no more than one of the first four bytes of LZIP are trailing
data (shown and labelled, and said to be ignored by lzip unless it runs with
--trailing-error; zeros are named as such), bytes of which two or three of the first four
match are a corrupt member header (an error in lzip, which stops; the viewer shows the bytes as a
corrupt header and goes on at the next member that decodes and checks out, if there is one), and
fewer than six bytes that start like the magic are a truncated header. A member whose LZMA data
cannot be decoded is followed in the same way: the bytes up to the next member that checks out are
shown as its unreadable data. The Members table lists the members, and the Symbols
table lists every decoded LZMA symbol with its position, length, distance and coder state: the first 200,000
of a member are recorded when the file is checked, and a page past them is decoded again from the nearest
saved decoder state (from the start of the member when its dictionary is over 64 MiB, which the table says is slow).
The decompressed data of every member, joined in order, opens as a file of its own, in its own
viewer: .tar.lz and .tlz as a tar archive. The LZMA decoder is the one
the LZMA and XZ viewer uses, run through its sliding window: the compressed bytes are read a piece at a time, the
dictionary is a window of the last dictionary-size bytes of output and the output is handed on as it is made, so a
member of any size is decoded in bounded memory. Data of more than 256 MB is offered in parts of 128 MB
(name, name.part2, …), and any part, in any member, is decoded again when it is opened
from a saved decoder state near it (taken during the pass that checks the member, for a dictionary of up to
64 MiB; a member with a larger dictionary keeps no saved states, so a part deep inside it is decoded from the
member’s start, which is slow and right), so the end of a member of many gigabytes does not need the whole file
decoded from its start each time.
Not described
Re-checked against the lzip manual (version 1.26, 19 July 2026) and lzip’s public source on 2026-11-13. The manual describes
the LZMA stream by prose and by the source of its reference decoder lzd; the
member page now gives the CRC-32 polynomial and procedure,
the initial probabilities, shift constants, range-coder procedures and bit-tree layouts from that source, and
version 0 members from lzip 1.16.
The Sync Flush marker of lzip 1.16’s version 0 members is decoded (the range coder restarts after it); see the member page.
In the explorer: the coded dictionary size is checked as lzip does (lzip.h of 1.16 to 1.26, lzlib and
lziprecover ignore the fraction on a 4 KiB base, so 2C is 4,096 and valid); the option “Dictionary size byte” at the top of
the viewer switches to the manual’s lzd, which always subtracts the fraction (2C = 3,840, “Invalid dictionary
size”). Every problem of a file is kept and the problems list above the tabs shows the first 500 and pages through the rest,
with the true count. The tail after the last member follows lzip 1.26’s main.cc: a file of six bytes or fewer
is “File ends unexpectedly at member header.”; a later tail of six bytes or fewer that matches LZIP as far
as it goes is “Truncated header in multimember file.” (exit status 2); a longer tail whose first four bytes equal
LZIP in two or three places is “Corrupt header in multimember file.”; anything else is trailing data, which
lzip ignores unless run with --trailing-error. TDATABOX boxes stacked at the end of the file
are shown as boxes. A version other than 1 is reported as not supported (“Version N member format not supported.”);
lzip 1.18 removed version 0 and the viewer still reads such members, the format lzip 1.16 wrote. Also reported: an empty
member in a multimember file, a nonzero first LZMA byte, and a trailer whose sizes are inconsistent.
Not decoded as lzip does: a short rep as the very first symbol of a stream. lzip 1.26 does not check it and takes a zero byte; the shared LZMA decoder used by the viewer reports it as reaching back before the start of the dictionary, so the member is shown as undecodable from that symbol. Such a stream is not produced by lzip itself.
Links
Software
Developers
- lzlib – library for reading and writing lzip files (C)
Reference
- Lzip manual – the program’s manual, including the file format
- lzip 1.26 source –
main.cc,lzip.h,decoder.cc,lzip_index.ccandChangeLog, read for the tail rule, messages, dictionary byte, version history and boxes