File Signature Table: Magic Numbers and Recovery Limits

File Signature Table

A file signature table lists recognizable byte patterns, their positions, and the file formats they help identify. These patterns, often called file magic numbers, let software recognize content without relying on its filename extension. Recovery tools can use them to find candidate files when directory entries or other file-system records are missing.

This matters when a recovered document has an unfamiliar name, a photo will not open, or a formatted drive has lost its folder structure. This guide explains common signatures, file headers and footers, and the limits of signature based file recovery. The inspection steps apply to Windows 10 and Windows 11.

Table of Contents

File Magic Numbers, Headers, and Footers

A signature is a recognizable pattern within a file. A header is a larger structure near its beginning and may contain a signature, version, dimensions, compression settings, or other fields. A footer or trailer provides information near the end, when the format defines one.

These terms describe related parts, but they are not interchangeable:

Term

What it describes

Practical meaning

Filename extension

A suffix such as .png or .zip

Suggests which application should open the file

File signature

Recognizable bytes at a defined or discoverable position

Helps identify a candidate format

File header

Initial structural information

May identify the format and describe its contents

File footer or trailer

An ending structure, if defined

May help locate or validate the end

File-system metadata

Records maintained by NTFS, FAT, or another file system

Can describe names, directories, sizes, and storage locations

Changing an extension does not convert the underlying format. Likewise, recognizable opening bytes do not prove that the rest of a file is present or correct.

Here, “signature” means a format-identification pattern. It does not mean a cryptographic digital signature.

File Signature Table for Common Formats

All values below are hexadecimal bytes in file order. Offsets are measured from the beginning of the candidate file, starting at zero.

Format

Identification bytes

Offset and conditions

Ending or validation clue

PNG

89 50 4E 47 0D 0A 1A 0A

Offset 0 of a PNG datastream

Ends with an IEND chunk; validate chunk lengths and CRCs

JPEG

FF D8 start-of-image marker; common beginnings include FF D8 FF E0 and FF D8 FF E1

Offset 0; following markers vary

FF D9 is the end-of-image marker; image decoding provides further checks

PDF

25 50 44 46 2D, meaning %PDF-

Standard file header at offset 0, followed by version information

%%EOF marks an ending, but incremental updates can create multiple occurrences

ZIP

50 4B 03 04

A local file header; commonly at offset 0 in an ordinary nonempty archive

Parse the central directory and end-of-central-directory record

DOCX, XLSX, PPTX

Commonly 50 4B 03 04

Ordinary unencrypted ZIP-based Office packages

Inspect package content types, relationships, and internal parts

WebP

52 49 46 46 (RIFF) and 57 45 42 50 (WEBP)

RIFF at offset 0; WEBP at offset 8; bytes 4–7 contain a size field

Check RIFF size and chunk structure rather than a universal footer

Windows PE executable

4D 5A (MZ), followed elsewhere by 50 45 00 00

MZ at offset 0; the field at offset 0x3C points to the PE signature

Validate the PE header and section information; MZ alone is insufficient

This is a reference table, not a complete recovery rule set. An empty ZIP archive can begin with its end-of-central-directory record, and a self-extracting archive can have executable data before its ZIP records.

The ZIP end record begins with 50 4B 05 06, but those four bytes are not the complete record or necessarily the final bytes. Fields and an optional archive comment follow. The separate ZIP header guide explains the archive structures in more detail.

Shared Signatures and File-System Signatures

A matching signature may identify a format family rather than one exact extension.

For example, DOCX, XLSX, and PPTX normally use ZIP packaging. A scanner finding 50 4B 03 04 has found a possible ZIP record; it has not yet established that the archive is a Word document. Content types and internal parts, such as word/document.xml in a typical DOCX package, provide additional evidence.

WebP offers another example: RIFF alone is insufficient because other formats also use RIFF containers. The WEBP identifier at offset 8 narrows the identification.

A Volume Signature Identifies a Different Object

Hex editors also show signatures belonging to file systems. The NTFS text in the screenshot below belongs to a volume boot sector, rather than the header of an individual photo or document. Finding it does not identify the user files stored on that volume.

A Volume Signature Identifies a Different Object

HxD developer screenshot showing the NTFS volume identifier, cropped and outlined for clarity.

How Signature Based File Recovery Works

Signature based file recovery, commonly called file carving, searches readable storage for patterns associated with supported file formats. It can locate content without depending on the original directory records.

A carver generally needs to perform several tasks:

  1. Locate a candidate start. Match an expected signature and its position relative to the proposed file beginning.
  2. Check the structure. Examine fields, record layouts, or format-specific consistency rules to reject unlikely matches.
  3. Determine the extent. Use internal sizes, parsed records, ending structures, or tool-specific stopping rules.
  4. Save and validate the candidate. Write it to separate storage and check whether it can be interpreted correctly.

A simple file header based recovery rule may recognize only the beginning. A more capable parser can interpret the format to determine its length and assess validity. Neither approach automatically supplies the original map of fragmented storage locations.

PhotoRec is a documented example of a file carver. Its custom signature definitions include an extension, an offset, and a byte pattern. Adding such a rule helps recognition; it does not automatically add a complete parser or solve fragmentation.

How Signature Based File Recovery Works

Signature Recovery vs Metadata Recovery

The main difference is the information used to locate and assemble a file.

Metadata recovery interprets surviving file-system records. On NTFS, the Master File Table can hold names, attributes, and mappings for file data. On FAT-based volumes, directory entries and the File Allocation Table contribute different parts of that information.

Recovery concern

Metadata recovery

Signature recovery

Main evidence

File-system records and allocation information

File content patterns and format structures

Original names and folders

May survive when relevant records remain usable

Usually unavailable from carving alone

File length

May be recorded explicitly

Must be inferred or parsed

Fragmented files

Surviving mappings can identify separate extents

Reconstruction depends heavily on format and tool

Missing file-system records

Can limit reconstruction

May still locate recognizable content

Overwritten contents

Cannot recreate replaced bytes

Cannot recreate replaced bytes

These approaches can complement each other. A recovery application may present results from both methods in one scan.

“Deep scan” is not a standardized promise that a tool uses only signatures or can reconstruct every fragmented file. Its meaning depends on the program.

How to Inspect a File Header in Windows

For a readable file, Windows PowerShell 5.1 includes Format-Hex. Inspect a copy on healthy storage. If the file has disappeared completely, this command cannot locate it by its former path.

Replace the example path below with the actual location of the copied file:

  1. Format-Hex -LiteralPath ‘E:\Inspection\sample.bin’ |
  2. Select-Object -First 4

This displays the first four output rows without changing the file.

Read the output as follows:

  • The left column gives the hexadecimal offset.
  • Each pair of hexadecimal digits represents one byte.
  • The text area shows printable characters; dots can represent nonprintable bytes.

For example, 25 50 44 46 2D corresponds to %PDF-. Finding it at the beginning supports PDF identification even if the extension is .bin.

For a suspected WebP file, check both RIFF at offset 0 and WEBP at offset 8. Checking only the first four bytes leaves the container type unresolved.

A hex editor can inspect other positions or the end of a copied file. Use read-only mode when available. Do not overwrite opening bytes merely to make them match the table: header editing cannot replace missing content or establish the correct format.

Why Recognized Files Can Still Fail to Open

A signature match establishes a candidate, not a complete recovery.

Fragmentation Breaks Simple Contiguous Carving

A file may occupy several nonadjacent groups of storage clusters. Without usable mappings, a carver may continue into unrelated data after recovering the first fragment.

Example: A video starts in one region, while its next fragment lies elsewhere. Finding the opening structure does not reveal where that next fragment begins. Some tools can reconstruct particular fragmented formats, but support is format-specific.

Short Matches and Embedded Files Create Extra Results

A short byte sequence can occur accidentally or inside another file. A JPEG thumbnail embedded in a larger document is real image content, but recovering it does not mean the containing document was recovered.

This helps explain duplicate-looking images, unexpectedly small files, and results that do not correspond to separate original files.

Ending Markers Need Context

The file header and footer must belong to a structurally consistent object. Stopping at the first apparent ending pattern can truncate a candidate; continuing too far can append unrelated data.

PDF incremental updates illustrate the problem: earlier %%EOF markers can remain inside a later saved version. PNG instead requires a valid chunk sequence ending in IEND, not simply an arbitrary occurrence of the text “IEND.”

Some Original Bytes Are No Longer Available

Overwriting destroys the previous contents of the affected locations. On SSDs, TRIM and subsequent controller behavior can also make deleted contents unavailable to ordinary reads.

Encryption creates a different boundary. A scanner examining an encrypted volume’s ciphertext cannot generally identify the original plaintext file headers. Authorized decryption or an unlocked view is needed first.

Choosing a Recovery Approach and Verifying Results

If important files are missing, stop writing to the affected device. Avoid reformatting or repairing its file system before protecting the data. A drive that repeatedly disconnects, reports read errors, or makes unusual mechanical noises needs assessment before repeated scans.

For stable, readable storage, use this order:

  1. Check backups and intact copies.
  2. Inspect recovery results based on surviving file-system records.
  3. Use file signature recovery when records are insufficient or specific files remain missing.
  4. Save recovered candidates to another physical drive.
  5. Validate the contents before treating the recovery as complete.

For a memory-card scenario, the formatted SD card recovery guide applies this distinction to practical recovery choices.

Validation should match the format. Open documents and check their pages, view images at full resolution, test archive extraction, and check video playback at several positions. A thumbnail or opening frame is insufficient evidence for a large file.

When a trusted original is available, a matching cryptographic hash provides stronger evidence of byte-for-byte equality. A hash calculated only after recovery cannot prove that the recovered file matches its lost original.

FAQs

Does every file type have a unique magic number?

No. Some formats share signatures, and plain-text files may lack a dependable identifying header. Identification can require several fields, internal structures, or contextual evidence.

Can renaming a recovered ZIP file to DOCX restore the document?

Only when the file already contains a valid Word package and the extension is the problem. Renaming cannot reconstruct missing ZIP records, XML parts, or document content.

Is a file footer always required for recovery?

No. Some formats provide lengths or structures that a parser can follow without a fixed footer. Recovery behavior also depends on the tool's implementation.

Can signature recovery preserve photo dates?

Embedded metadata, such as surviving Exif information, may retain a capture date. That differs from recovering the original file-system timestamps, filename, or folder location.

Can file carving recover overwritten files?

It cannot reconstruct bytes that have been replaced. Surviving fragments, another copy, or a backup may still help, but recognizing a signature does not reverse overwriting.

Does successful preview mean the entire file is intact?

No. A preview may read only part of a file or display an embedded thumbnail. Save the candidate separately and check its actual contents before relying on it.

Jason is a data recovery and technical support specialist with over 15 years of hands-on experience. He has worked extensively with frontline users, troubleshooting difficult data loss cases and providing practical recovery solutions for accidental deletion, formatted drives, damaged file systems, lost partitions, system failures, and other recovery emergencies. His expertise also includes backup and restoration, file repair, and disaster recovery, with a strong emphasis on safe, reliable, and technically accurate guidance.