112

Since Excel 2007, Microsoft has split the classical .xls format to several formats (in particular, .xlsx, .xlsm, .xlsb). I've got no problem to understand the use and purpose of .xlsx format but I am still wondering whether we should use a .xlsm or a .xlsb format when creating a file containing some VBA.

Of course, you can find some topics on the web, for instance:

What I've understood from this last link is that .xlsm is some kind of XML format and thus, needed for custom ribbon tab.

Beyond the conceptual difference between the format (.xlsm is based on XML VS .xlsb is a binary file), is there any practical difference when using any of this file (apart from the ribbon customization)?
Have you ever seen any real difference when using any of these formats?

3

5 Answers 5

96

.xlsx loads 4 times longer than .xlsb and saves 2 times longer and has 1.5 times a bigger file. I tested this on a generated worksheet with 10'000 rows * 1'000 columns = 10'000'000 (10^7) cells of simple chained =…+1 formulas:

╭──────────────╥────────┬────────╮
│              ║ .xlsx  │ .xlsb  │
╞══════════════╬════════╪════════╡
│ loading time ║ 165s   │  43s   │
├──────────────╫────────┼────────┤
│ saving time  ║ 115s   │  61s   │
├──────────────╫────────┼────────┤
│ file size    ║  91 MB │  65 MB │
╰──────────────╨────────┴────────╯

(Hardware: Core2Duo 2.3 GHz, 4 GB RAM, 5.400 rpm SATA II HD; Windows 7, under somewhat heavy load from other processes.)

Beside this, there should be no differences. More precisely,

both formats support exactly the same feature set

cites this blog post from 2006-08-29. So maybe the info that .xlsb does not support Ribbon code is newer than the upper citation, but I figure that forum source of yours is just wrong. When cracking open the binary file, it seems to condensedly mimic the OOXML file structure 1-to-1: Blog article from 2006-08-07

7
  • 2
    only one trial, no ministat(1) results though :-\ Dec 31, 2012 at 22:49
  • 2
    I confirm that one of my files with a custom ribbon works just fine in xlsb.
    – David G
    Jul 7, 2015 at 20:01
  • 6
    @PatrickLepelletier .xlsx is like .xlsm, only with macros disabled. Both are XML based. In contrast to that, .xlsb is binary. So you should read the question as "{.xlsx / .xlsm} versus .xlsb". (There is no macro-disabled version of the binary .xlsb.) Jun 18, 2016 at 13:50
  • 4
    If xlsb is better, why is xlsx the default? There must be some disadvantage to xlsb?
    – PProteus
    Aug 4, 2017 at 15:26
  • 3
    @PProteus, simply put xlsb is better in a specific area. The whole idea of introducing XML standard was to be more transparent, making files more portable and the file manipulation easier. Now third party tools can properly read/write Excel files (I know, they could do that with some reverse engineering but that was error prone). On the other hand using large Excel files is really not a primary usage of Excel so the trade-off for being more portable is little. Additionally using a non-macro file increases a security to some degree. As a comparison, why bother with Java if Assembler is better?
    – Ister
    Aug 10, 2018 at 10:42
62

They're all similar in that they're essentially zip files containing the actual file components. You can see the contents just by replacing the extension with .zip and opening them up. The difference with xlsb seems to be that the components are not XML-based but are in a binary format: supposedly this is beneficial when working with large files.

https://blogs.msdn.microsoft.com/dmahugh/2006/08/22/new-binary-file-format-for-spreadsheets/

1
  • 1
    .xls files were binary in format. .xlsb files retain this binary format for the newer office versions. There is both a size difference and a speed benefit to storing the data in binary format, though the improvements will only be noted in VERY large files. Jun 23, 2017 at 16:05
11

One could think that xlsb has only advantages over xlsm. The fact that xlsm is XML-based and xlsb is binary is that when workbook corruption occurs, you have better chances to repair a xlsm than a xlsb.

3
  • 1
    If that's true then the xlsm is the one for me. I have been cursed with corrupted Excel files since the mid-late '90s. It was almost enough to make me take up ditch digging for a living. Office 2000 was the first version with the file recovery feature. But I don
    – riderBill
    Dec 10, 2015 at 21:04
  • XLSX and XLSM file extensions are much, much more stable than the pre-2007 Excel XLS file extension. Jun 15, 2016 at 22:08
  • Why the upvotes? Is there any actual evidence of this? "Myth: Binary workbooks are more prone to file corruption" spreadsheet1.com/how-to-save-as-binary-excel-workbook.html
    – johny why
    Oct 9, 2021 at 19:47
9

Just for posterity, here's the text from several external sources regarding the Excel file formats. Some of these have been mentioned in other answers to this question but without reproducing the essential content.

1. From Doug Mahugh, August 22, 2006:

...the new XLSB binary format. Like Open XML, it’s a full-fidelity file format that can store anything you can create in Excel, but the XLSB format is optimized for performance in ways that aren’t possible with a pure XML format.

The XLSB format (also sometimes referred to as BIFF12, as in “binary file format for Office 12”) uses the same Open Packaging Convention used by the Open XML formats and XPS. So it’s basically a ZIP container, and you can open it with any ZIP tool to see what’s inside. But instead of .XML parts within the package, you’ll find .BIN parts...

This article also refers to documentation about the BIN format, too lengthy to reproduce here.

2. From MSDN Archive, August 29, 2006 which in turn cites an already-missing blog post regarding the XLSB format:

Even though we’ve done a lot of work to make sure that our XML formats open quickly and efficiently, this binary format is still more efficient for Excel to open and save, and can lead to some performance improvements for workbooks that contain a lot of data, or that would require a lot of XML parsing during the Open process. (In fact, we’ve found that the new binary format is faster than the old XLS format in many cases.) Also, there is no macro-free version of this file format – all XLSB files can contain macros (VBA and XLM). In all other respects, it is functionally equivalent to the XML file format above:

File size – file size of both formats is approximately the same, since both formats are saved to disk using zip compression Architecture – both formats use the same packaging structure, and both have the same part-level structures. Feature support – both formats support exactly the same feature set Runtime performance – once loaded into memory, the file format has no effect on application/calculation speed Converters – both formats will have identical converter support

3
  • "file size of both formats is approximately the same" -- This must be obsolete info. Smaller size for xlsb is common knowledge. i just saved a 25 MB xlsx file (containing one million records by four fields and no macros) as xlsm and xlsb. The xlsm copy is also 25 MB. The xlsb copy is 9.6 MB.
    – johny why
    Oct 9, 2021 at 19:50
  • @johnywhy maybe something has improved in 15 years ... or it could also be sensitive to the data ? Oct 9, 2021 at 20:00
  • 1
    I suspect that the "similar size" is based on sheets with lots of content, formulas etc, in relatively few cells, so there is limited overhead due to the xml opening and closing tags. Maybe when you have lots of cells with little data in them, as @johny why did, the xml opening and closing tags take a larger toll? Nov 3, 2021 at 7:33
6

The XLSB format is also dedicated to the macros embeded in an hidden workbook file located in excel startup folder (XLSTART).

A quick & dirty test with a xlsm or xlsb in XLSTART folder:

Measure-Command { $x = New-Object -com Excel.Application ;$x.Visible = $True ; $x.Quit() }

0,89s with a xlsb (binary) versus 1,3s with the same content in xlsm format (xml in a zip file) ... :)

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.