DevTools Logo

Safetensors Header Inspector

Safetensors Header Inspector

Read a .safetensors header slice only — tensor names, shapes, dtypes, offsets, parameters and memory, entirely in your browser.

Safetensors files

no files
Drop .safetensors files here to inspect their headers. Weights are never read.
Try an example

Header report

Drop a .safetensors file to inspect its header

Only the first few kilobytes are read — a 40 GB checkpoint opens just as fast.

    Examples

    BF16 attention weight

    Input
    blk.0.attn.q.weight · BF16 · [32, 64] · offsets [0, 4096]
    Output
    2,048 params · 4.0 KB · absolute start 8 + header length

    Expected bytes equal 2,048 × 2, so the row has no mismatch flag.

    Scalar step counter

    Input
    steps · I64 · [] · offsets [74752, 74760]
    Output
    1 param · 8 bytes

    An empty shape is treated as one element, not zero.

    Corrupt span

    Input
    weights · F32 · [2, 2] · offsets [0, 4]
    Output
    4 params · 4 bytes · byte/size mismatch

    Four F32 elements need 16 bytes; the short span is flagged amber.

    About this tool

    Safetensors Header Inspector opens the small JSON header at the front of a .safetensors checkpoint. It reads an 8-byte little-endian length, slices out the header, and turns the tensor table into a readable inventory — names, dtypes, shapes, offsets, parameter counts and memory use — without reading a single weight byte.

    Derived statistics do the real work: per-dtype tensor and byte totals, a parameter count from shape products, each tensor's share of the data section, and warnings for unknown dtypes, impossible offsets, overlapping spans or shape/span disagreements. Drop multiple shards to combine their totals and reveal duplicate tensor names that would otherwise quietly undercount a checkpoint.

    Search names by substring or regular expression, filter by dtype or a preset such as attention and LoRA, inspect the verbatim header JSON and __metadata__, then export a CSV inventory or Markdown summary. Parsing stays in your browser tab; a 40 GB file opens as fast as a small one because only the header is sliced.

    What this tool does not do

    • Tensor data, statistics and values are never inspected.
    • Only local files are supported; remote URLs and range requests are out of scope.
    • The element-size table covers the published dtype set; a future dtype is reported as unknown instead of guessed.
    • Very large tables render 200 rows at a time with a show-more control rather than full virtualization.
    • Quantization figures are informational arithmetic, not a conversion plan.

    How to use this tool

    1. Drop a checkpoint

      Choose or drop one or more .safetensors files, or load the built-in synthetic sample to explore the UI.

    2. Read the summary

      Check total parameters, tensor bytes and the per-dtype table; amber rows and warnings identify header problems.

    3. Find a tensor

      Filter by name (optionally as regex), dtype or a preset, then sort by bytes, parameters, name or dtype.

    4. Export the evidence

      Copy the filtered inventory as CSV, download it, or save a Markdown header summary for a bug report.

    Use cases

    Checkpoint audit

    Verify which tensors a fine-tune saved and whether dtypes match the training config.

    Memory planning

    Sum bf16/fp16 bytes before estimating q8 or q4 footprint for a deployment.

    Shard review

    Aggregate model-00001-of-00004 style shards and catch duplicated tensor names.

    Header fields shown

    FieldMeaning
    dtypeElement type such as F32, BF16, F16, I64; drives the element-size cross-check.
    shapeDimension list; an empty list is a scalar with one parameter.
    data_offsetsStart and end relative to the data section; absolute position is 8 + header length + offset.
    paramsProduct of the shape dimensions (1 for scalars).
    bytesOffset span, compared with params × element size for mismatch flags.
    sharePercent of the declared data section occupied by the tensor.

    Span checks use the declared data section, not the whole file, so a correctly packed file is never false-flagged.

    Common mistakes

    Mistake:Assuming offsets are absolute file positions.

    Fix:They start at the beginning of the data section, after the length prefix and header.

    Mistake:Treating q8/q4 estimates as exact deployment sizes.

    Fix:Scales, zero points and sensitive layers add overhead; use a VRAM calculator for budgets.

    Mistake:Expecting tensor values or min/max statistics.

    Fix:This tool is header-only by design; weights are never read.

    Mistake:Using this for GGUF files.

    Fix:GGUF has a different metadata layout; use a GGUF metadata inspector instead.

    Mistake:Pasting exported tensor names into a spreadsheet without checking.

    Fix:CSV cells beginning with formula characters are neutralised with an apostrophe.

    Frequently asked questions

    How is a safetensors header structured?

    The file starts with an unsigned 64-bit little-endian integer giving the header length in bytes. Those bytes are UTF-8 JSON mapping each tensor name to an object with dtype, shape and data_offsets. An optional __metadata__ object holds string key/value pairs. Tensor weights follow the header; the inspector only reads the prefix and never touches them.

    How do I count parameters in a safetensors file?

    For every tensor, multiply the shape dimensions (a scalar with shape [] counts as one), then add the results. The summary card does this for all tensors and the dtype table breaks the count down by element type. It matches the checkpoint's parameter count as long as the header lists every tensor.

    Does it read the tensor data?

    No. The reader asks the browser for the first eight bytes to learn the header length, then slices exactly those header bytes. A 40 GB checkpoint therefore opens about as quickly as a tiny one, and no weights are loaded into memory or uploaded anywhere.

    What dtypes can it show?

    The published safetensors element sizes are covered: BOOL, U8, I8, I16, I32, I64, F8_E4M3, F8_E5M2, F8_E8M0, F16, BF16, F32 and F64. A dtype outside this table is not guessed: its row is counted separately and flagged so a newer format variant is visible rather than silently mis-sized.

    Can it handle multi-GB files and sharded checkpoints?

    Yes for both. File size does not matter because only the header is sliced. Drop several shards at once to get combined parameter and byte totals, a merged dtype breakdown, and warnings for tensor names that appear in more than one shard. Completeness against an index.json weight map is not checked.

    Why is a tensor row flagged amber?

    Possible reasons are an unknown dtype, an invalid shape, offsets outside the declared data section, overlapping spans, or a byte span that differs from parameters × element size. The row lists the flags, and a summary warning counts the affected tensors so a malformed header is hard to miss.

    Are my model files uploaded or stored?

    No. Slicing, parsing, analysis and exports all happen in the browser tab. Nothing is sent to a server, no file contents are saved, and the downloaded CSV or Markdown is generated locally.

    References & standards