I was wondering since in Ubuntu 10.10 I have the ability to create both xz and lzma archives. Should I switch to xz?



  • 1
    Note that there's also a newer lz archive type that has basically been introduced "since this discussion" stackoverflow.com/a/49456056/32453 so don't confuse it with the lzma mentioned here :)
    – rogerdpack
    Commented Mar 23, 2018 at 18:16
  • It's hard to tell, when you don't tell us your requirements. For instance, is long-term preservation a concern (think research data or backups)? Then you'd want to use the most compatible and long-term supported format.
    – Nemo
    Commented Oct 15, 2021 at 5:57

4 Answers 4


I disagree with @dv3500ea's conclusion, "OK using either", as it was inappropriate. Even at the posted date/time, .lzma files were known to be replaced completely by .xz. The author of both Utils has said publicly, users should transition to XZ-Utils ≥ 5.00. The last LZMA-Utils release was 2008-07-30, and discontinued.

LZMA Utils are legacy data compression software with high compression ratio. LZMA Utils are no longer developed, although critical bugs may be fixed as long as fixing them doesn't require huge changes to the code.

Users of LZMA Utils should move to XZ Utils. XZ Utils support the legacy .lzma format used by LZMA Utils, and can also emulate the command line tools of LZMA Utils. This should make transition from LZMA Utils to XZ Utils relatively easy.

The determining factor might not be compression, although ironically it was for this example. "practical reasons" are a self-evident, and significant, reason to use XZ-Utils. Additionally the .xz format allows you to specify compression algorithms, and filters, so .xz files can use either LZMA or LZMA2. Avoid creating new .lzma files, they are considered a legacy format.

As for even keeping LZMA-Utils around: don't. XZ-Utils has support for legacy .lzma files. It also has wrappers for scripts still using LZMA-Utils. If all those reasons were still insufficient, Ubuntu dropped legacy lzma-utils from its repository.

  • 1
    "The author of both Utils has said publicly, users should transition to XZ-Utils ≥ 5.00." Citation needed. :-) Commented Feb 13, 2014 at 23:48
  • 1
    @FaheemMitha: Since this is a post, and not an educational reference or original research, the citation would only be the project page. I assumed since it was from the LZMA-Utils author, and he wrote BOTH utility sets with intention of xz-utils replacing legacy LZMA-Utils, it was self-evident. ...But For anyone who want's to get more details, tukaani.org/lzma. Commented Oct 3, 2014 at 17:05

This benchmark provides some good information about this issue. It seems that LZMA has slightly better compression ratios and performance than XZ but XZ is generally preferred due to 'practical reasons' (I'm not sure what these are).

XZ is an implementation of the lzma2 algorithm and is better at compressing 'uncompressable' data:

lzma2 is the method of compression employed by the 7-Zip LZMA2 compressor. LZMA2 is a modified version of LZMA that offers a better compression ratio for uncompressible data (random data expands about 0.005%, compared to 1.35% with original LZMA), and optionally can compress multiple parts of large files in parallel, greatly increasing compression speed but with a possible reduction in compression ratio (see LZMANumBlockThreads). Like LZMA, it can consume a lot of memory; see the above table. If a compression level isn't specified, it defaults to max.


You should be OK using either.

  • Out of curiosity, did you decide which to use?
    – dv3500ea
    Commented Oct 10, 2010 at 15:59
  • 1
    Actually after a bit of testing it seems like xz will be the way forward. It also saves quite a bit of compression (10mb somtimes) on binary stuff over lzma. Commented Oct 13, 2010 at 10:13
  • 9
    That was not an appropriate answer, in regards to "OK using either". Even at the time when he posted this question, .lzma files were known to be replaced completely by .xz in the near future. The author of LZMA-Utils has said publicly, they were deprecated and use xz-utils from 5.00 onward. The last LZMA-Utils release was 2008-07-30, even at the time years old. So compression wise, the improvements might not be a huge determining factor. (ironically in case it was) But "political" reasons should have been a significant reason to use XZ-Utils, and avoid making new .lzma archives. Commented Jan 22, 2012 at 11:17
  • 1
    @TechZilla Have you considered posting your take on this as an alternative answer?
    – ændrük
    Commented Oct 5, 2012 at 15:55
  • 1
    The practical reasons for LZMA2 are multithreading support. Single threading performance and compression ratio are slightly lower but on a system with several cores used expect LZMA2 to be much faster when decoding. Commented Nov 24, 2013 at 0:24

Definitely you shouldn't use lzma as others say.

Antonio Diaz Diaz, author of lzip format, says Xz format is inadequate for long-term archiving. If you want to backup your important files, consider other file formats such as bzip2, which has corruption recovery tool.

  • 2
    xz is considered unsafe by some. That doesn't apply to lzma though. Commented Apr 10, 2018 at 18:38

xz is preferred due to it having the highest compression rate. However, it compresses slower, but it makes up for it with its compression.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .