Excel spreadsheet subheader

application/vnd.ms-excel

Safe

Magic Bytes

Offset: 0
D0 CF 11 E0 A1 B1 1A E1

The Excel spreadsheet subheader (XLS) is a legacy binary container format developed and maintained by Microsoft for organizing structured workbook data. It was the primary storage mechanism for Microsoft Excel from 1987 until 2007, supporting complex data relationships, formulas, and visual charts. Although replaced by the open XML standard, these files are still encountered in archival systems and require careful handling due to potential security risks from embedded macro code.

Extension

.xls

MIME Type

application/vnd.ms-excel

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .xls files in Python

Python
def is_xls(file_path: str) -> bool:
    """Check if file is a valid XLS by magic bytes."""
    signature = bytes([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])
    with open(file_path, "rb") as f:
        return f.read(8) == signature

How to validate .xls files in Node.js

Node.js
function isXLS(buffer: Buffer): boolean {
  const signature = Buffer.from([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]);
  return buffer.subarray(0, 8).equals(signature);
}
Go
func IsXLS(data []byte) bool {
    signature := []byte{0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1}
    if len(data) < 8 {
        return false
    }
    return bytes.Equal(data[:8], signature)
}

API Endpoint

GET /api/v1/xls
curl https://filesignature.org/api/v1/xls

Related Formats