Inside a XLS File: Signature, Structure and MIME Type

November 08, 2026 · XLS.now Editorial · XLS Essentials

Learn how XLS is identified and what its internal components mean.

The Binary Container: OLE2 Compound Document

A .xls file is a binary container conforming to the OLE2 (Object Linking and Embedding 2) compound document specification. The format organizes data as a hierarchical storage system within a single file, containing multiple independent streams rather than a flat byte sequence. This architecture is shared with legacy .doc and .ppt formats, making the container itself format-agnostic.

The XLS specification defines the payload as a BIFF (Binary Interchange File Format) stream stored inside this OLE2 container. The file functions as a miniature filesystem: a root directory points to named streams, each holding a specific data category—workbook structure, shared strings, formatting tables, embedded objects, or document metadata. No single stream contains the entire spreadsheet.

The 8-Byte Signature and Its Limitations

Every valid XLS file begins with the OLE2 magic signature:

D0 CF 11 E0 A1 B1 1A E1

This 8-byte sequence identifies the file as an OLE2 compound document but provides no information about the application that created it. The identical header appears in legacy Word (.doc) and PowerPoint (.ppt) files. Signature-only detection is therefore insufficient for format identification.

Why Deeper Inspection Is Required

  • A file renamed from .doc to .xls retains the valid OLE2 header and passes superficial signature checks.
  • File-type detection utilities must traverse the OLE2 directory structure and locate the Root Entry to examine stream names.
  • The definitive XLS indicator is a stream named Workbook or Book in the root storage. A stream named WordDocument indicates a DOC file; PowerPoint Document indicates PPT.
  • Antivirus engines, mail attachment filters, and forensic tools rely on this stream-name inspection rather than extension or header alone.

MIME Type and Extension Conflicts

The registered MIME type for XLS is:

application/vnd.ms-excel

This identifier is assigned based on the presence of the Workbook stream within the OLE2 container, not the file extension. Some legacy systems also accept application/msexcel or application/x-msexcel, but application/vnd.ms-excel is the authoritative type per IANA registration.

Edge Cases in MIME Assignment

  • Excel 2.x files (BIFF2) share the same OLE2 header and MIME type but use a different internal record structure. The BIFF version, stored in the BOF record, distinguishes these from later formats. Modern Excel and LibreOffice can open them, but the record layout differs significantly.
  • Password-protected XLS files retain the standard OLE2 structure and MIME type. The Workbook stream is encrypted, but the container header and stream directory remain unmodified. Only the stream content is scrambled.
  • Extension mismatch triggers a validation failure. If a .xls file lacks a Workbook stream—for example, a renamed CSV or DOC—Excel detects the discrepancy and falls back to the text import wizard rather than attempting binary parsing.

Internal Stream Structure

The OLE2 container organizes data into named streams within a root storage. The streams critical to XLS validation and operation are:

  • Workbook — The primary stream containing BIFF records that define sheets, cells, formulas, formatting, and structural metadata. If this stream is absent or its directory entry is corrupt, no spreadsheet application will open the file.
  • SummaryInformation — A metadata stream holding author, title, creation date, last-modified timestamp, and application version. This stream is optional for workbook functionality and can be stripped without affecting cell data or formulas.
  • OleObjectN — Numbered sub-storages containing embedded objects such as charts, images, or nested OLE documents. Each is a self-contained OLE2 structure within the parent file.

The OLE2 Root Entry must contain a valid directory pointer to the Workbook stream. File repair tools often reconstruct this pointer when it becomes misaligned due to partial writes or truncation.

BIFF Records Inside the Workbook Stream

The Workbook stream consists of a sequential series of BIFF records, each composed of a record type identifier, a length field, and a data payload. Records are the atomic units of spreadsheet data.

Record ID (hex) Name Purpose
0x0009 BOF Beginning of File: marks the start of a workbook or worksheet
0x000A EOF End of File: terminates a sheet or workbook stream
0x00FD SST Shared String Table: stores all unique text strings
0x020B LABEL A text cell entry (BIFF2–BIFF7)
0x000D FORMULA A formula with cached result and dependency metadata
0x014D WINDOW2 Worksheet display settings (gridlines, zoom, split panes)

Shared String Table and File Size

The SST is a deduplication structure: each unique string in the workbook is stored once and referenced by index from individual cells. This design reduces file size when labels repeat across rows or sheets. A workbook with 10,000 cells containing the string "Completed" stores the string once in the SST and 10,000 two-byte indexes, rather than 10,000 copies of the string.

If the SST becomes corrupt, cells referencing its indices may display #REF! or render as blank. Numeric cells and formulas that do not reference strings remain unaffected.

Structural Validation Checks

A file is structurally conformant as XLS if and only if all of the following conditions are met:

  1. OLE2 header present: Bytes 0–7 match D0 CF 11 E0 A1 B1 1A E1.
  2. Workbook stream exists: The OLE2 root directory contains an entry named Workbook or Book.
  3. BOF record opens the stream: The first record in the Workbook stream is a BOF with a BIFF version field in the range 0x0500–0x0600 (corresponding to Excel 5.0 through Excel 2003). Versions outside this range indicate either an older Excel 2.x–4.0 file or a non-conformant stream.
  4. EOF record closes the stream: The final record in the Workbook stream is an EOF record (0x000A).

Any deviation—missing Workbook stream, incorrect BIFF version, absent BOF/EOF pair, or truncated record sequence—renders the file corrupt or non-conforming. Repair tools attempt to re-synchronize the OLE2 directory or rebuild the SST from surviving cell records, but they cannot recover data from sectors that were never written.

Identification Without a Hex Editor

On Linux or macOS, the file command inspects OLE2 internals and reports the format based on stream names:

file --mime-type suspect.xls

Expected output for a valid XLS:

application/vnd.ms-excel

For a renamed DOC or PPT, the output reflects the actual content:

application/msword
application/vnd.ms-powerpoint

On Windows, the third-party tool trID performs equivalent stream-name analysis. The critical check is the presence of the Workbook stream, which neither the file extension nor the OLE2 header alone can confirm.

Hard Limits for inside a xls file structure and signature

  • BIFF version range: 0x0500 (Excel 5.0) through 0x0600 (Excel 2003). BIFF8 (0x0600) is the most common version for files created by Excel 97–2003.
  • Maximum OLE2 file size: 2 GB for the compound document container, though practical workbook limits are lower due to row and column constraints (65,536 rows × 256 columns for XLS).
  • SST index limit: The Shared String Table uses 16-bit or 32-bit indices depending on BIFF version. BIFF8 supports up to 2^32-1 unique strings, but the practical limit is bounded by available memory and the 2 GB container ceiling.

Reference for inside a xls file structure and signature

  • Microsoft Open Specifications: [MS-XLS] Binary Interchange File Format — https://learn.microsoft.com/en-us/openspecs/officefileformats/ms-xls/