ZERO-UPLOAD SANDBOX
.npz Tier 1 · Deep AST Parser

NumPy Zipped Array Archive

ZIP container bundling multiple named NumPy `.npy` tensor arrays, widely used for embeddings, calibration datasets, and JAX/MLX checkpoints.

Shares PKZIP `50 4B 03 04` magic bytes; disambiguated by inspecting the ZIP Central Directory for `.npy` member entries.

MIME Types application/x-npz, application/zip
Byte Endianness little
Container Family zip
0xFF

Drop any .npz file (even 100 GB+) to inspect locally

Reads tiny File.slice() header/footer pages in a sandboxed Web Worker · 0 Bytes Uploaded

Binary Signature & Wire Layout

.npz Magic Bytes & Header Offset Map

Offset: 0x00 (0 B) ASCII: PK..
50 4B 03 04

PKZIP Local File Header containing .npy member streams

Byte Offset Length Data Type Field Name Engineering Description
0x00 - 0x03 4 B uint32_le zip_lfh_sig PKZIP signature 0x04034B50
0x08 - 0x09 2 B uint16_le compression 0 = Store (np.savez), 8 = Deflate (np.savez_compressed)
0x1E+ var utf8 member_name First array entry name ending in .npy
Upload Gateway & AppSec Advisory

.npz Security & Polyglot Risk Matrix

Risk Level: medium
Arbitrary Code / Macros
NO (Inert Data)
Pickle Deserialization
HIGH RISK (Arbitrary Exec)
XML External Entity (XXE)
NONE
Polyglot Prepend Risk
YES (Check Tail/Offsets)
Backend Upload Validation Recommendation

Always load with np.load(file, allow_pickle=False) and enforce decompression byte quotas on Deflate-compressed .npz uploads.

Compiler-Verified Reference Code

Read .npz Header & Metadata Without Heavy Dependencies

import sys, zipfile
with zipfile.ZipFile(sys.argv[1], "r") as zf:
    npy_names = [n for n in zf.namelist() if n.endswith(".npy")]
    print(f"NPZ arrays ({len(npy_names)}): {npy_names}")
CI/CD & Unit Test Fixtures

Deterministic .npz Sample Files & Edge Cases

Open Full .npz Sample Matrix & Mutator →
minimalexpect: valid

minimal-weights.npz

Real np.savez output containing weights.npy (4x8 float32) and bias.npy (8 float32).

↓ Download (668 B)
SHA-256: 5df985f2575c4c4a1f58f21970bd74830b277688976534283c269be2ccfb2637
Exact: 668 bytes
curl -fsSL https://fileformat.co/fixtures/v1/npz/minimal-weights.npz -o minimal-weights.npz \
  && echo "5df985f2575c4c4a1f58f21970bd74830b277688976534283c269be2ccfb2637  minimal-weights.npz" | shasum -a 256 -c
realisticexpect: valid

checkpoint-deflated.npz

Real np.savez_compressed bundle with float32, float64, and int32 arrays.

↓ Download (1.1 KB)
SHA-256: 1da30aadf475322bd6b9df64d90d6fda4f4e600251c6c542bcca7c2a0d8a39ca
Exact: 1,151 bytes
curl -fsSL https://fileformat.co/fixtures/v1/npz/checkpoint-deflated.npz -o checkpoint-deflated.npz \
  && echo "1da30aadf475322bd6b9df64d90d6fda4f4e600251c6c542bcca7c2a0d8a39ca  checkpoint-deflated.npz" | shasum -a 256 -c
edge-caseTruncated ZIP EOCDexpect: parser_error

truncated-eocd.npz

Valid PK local headers but missing complete EOCD — np.load on the archive must raise.

↓ Download (654 B)
SHA-256: 3d8d77b9c97b839f497301ec2cbfb8fd34e7c19ae6e0f7ddee51c864c7eb05f5
Exact: 654 bytes
curl -fsSL https://fileformat.co/fixtures/v1/npz/truncated-eocd.npz -o truncated-eocd.npz \
  && echo "3d8d77b9c97b839f497301ec2cbfb8fd34e7c19ae6e0f7ddee51c864c7eb05f5  truncated-eocd.npz" | shasum -a 256 -c

Related Specifications & Alternatives