Excel Open XML Workbook is a document format commonly identified by .xlsx. Use the listed signatures, MIME types, and structure notes to validate files beyond the extension.
Do not trust the extension alone. Check the MIME type, the first bytes such as 50 4B 03 04, and format-specific structure when possible.
Container formats and damaged files can share the same opening bytes, so deeper validation may be required for production upload, preview, or conversion flows.
Detection example
SIGNATURE = bytes.fromhex("504b0304")
OFFSET = 0
def is_xlsx(path: str) -> bool:
with open(path, "rb") as f:
f.seek(OFFSET)
head = f.read(len(SIGNATURE))
return head == SIGNATURE
const SIGNATURE = [0x50, 0x4b, 0x03, 0x04];
const OFFSET = 0;
// bytes: a Uint8Array / Buffer holding the start of the file
export function isXlsx(bytes) {
return SIGNATURE.every((byte, i) => bytes[OFFSET + i] === byte);
}
package fileid
import "bytes"
var isxlsxSignature = []byte{0x50, 0x4b, 0x03, 0x04}
const isxlsxOffset = 0
func IsXlsx(b []byte) bool {
end := isxlsxOffset + len(isxlsxSignature)
if len(b) < end {
return false
}
return bytes.Equal(b[isxlsxOffset:end], isxlsxSignature)
}
Excel Open XML Workbook is used for data exchange, imports, exports, parser testing, and validation workflows. Encoding, delimiters, versions, and container structure often change implementation behavior.
Common detection mistakes
The .xlsx extension alone does not prove the file contents. Upload and conversion flows should combine extension, MIME type, leading bytes, and format-specific structure checks.
Excel Open XML Workbook can start with signatures such as 50 4B 03 04, but related containers and damaged files may require additional validation.
Security notes
Document formats may include scripts, attachments, macros, or external references. Sandbox previews and conversions, and avoid opening untrusted files directly.
Using samples
11 samples help test leading-byte detection, parser errors, upload limits, and download behavior.
Blue Sky XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Flower Garden XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Navy Blue Sky XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Nature of the Sky XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Sky Landscape XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Starry Sky XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Blue Night Sky XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Hibiscus Flower XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Arctic Sky XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
Sunset Rays XLSX is a Excel Open XML Workbook sample based on Wikimedia Commons. It can be used to test downloads, parsers, previews, and file type detection.
NASA Blue Marble XLSX is a Excel Open XML Workbook sample based on NASA Image and Video Library. It can be used to test downloads, parsers, previews, and file type detection.
What is the magic number (file signature) of Excel Open XML Workbook?
Excel Open XML Workbook files begin with the byte signature 50 4B 03 04 ("PK.."). Detect the format by reading these leading bytes rather than trusting the file extension alone.
What is the MIME type of Excel Open XML Workbook?
The MIME type for Excel Open XML Workbook is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
What file extension does Excel Open XML Workbook use?
Excel Open XML Workbook files use the .xlsx extension. The extension is a convention only and does not guarantee the file contents, so combine it with signature and structure checks.