Binary Viewer & Structure Inspector
Inspect binary files in VS Code: a fast, virtualized hex viewer (UltraEdit-style
layout) plus a user-defined structure decoder for firmware images, EEPROM /
flash dumps, device-config blobs, packet captures, memory dumps and other
proprietary binary formats.
Built on the VS Code Custom Editor API (not a text editor), so it opens
multi-hundred-MB and multi-GB files without loading them into memory.
Raw hex view
Classic Offset · Hex · ASCII layout. Select bytes in either column and the
other follows; the data inspector interprets the selection as every integer and
float type, little- and big-endian.

Structure view
Point a binary format definition at the file and read it as a tree of named
fields. Structures nest arbitrarily, child offsets are relative to their parent
(resolved to absolute for you), and selecting a field highlights exactly its
bytes back in the hex view.

Sections / memory map
Add a sections array to a format and the Sections tab shows a memory-map
table — Section · Start · End · Length, plus optional user-defined Flags
(rwx) and Display (Yes/No) columns. Click a row to select that region
in the hex view. Works with a fields-based format or a sections-only one; with
no sections array, rows are derived straight from the parsed top-level
fields instead, so they never drift out of sync with the Structure tab. From
the Raw tab, toolbar Section ◀ / ▶ buttons jump between sections
directly.

What you get
- 16 / 8 / 32 bytes per row, virtualized rendering, horizontal + vertical
scroll, full keyboard navigation, hex ⟷ ASCII selection sync.
- Word view & Field Colors — group the raw hex into 16/32/64-bit words
(
·LE reverses bytes so a little-endian 01 00 00 00 reads as 00000001),
and optionally tint each byte by its top-level field once a format is
applied — both raw-view-only, selection still works normally either way.
- Data inspector — per-byte hex/binary/octal/signed/unsigned/ASCII and
int8…int64 / uint8…uint64 / float32 / float64 for the selection in both
endiannesses.
- Structure decoding from declarative JSON: scalars, strings
(
ascii/utf8/utf16), enum, bit-fields (with a Bit 7…0 grid), array,
nested struct, timestamp, per-field endianness, scale/bias/unit.
- Nested structures — a field with a
fields array and no type is a
container; unlimited depth, mixes freely with flat fields, collapse/expand
remembered per session, Format › Header › Field breadcrumb.
- Sections / memory-map view — a
sections: [{ name, start, length, flags?, display? }] array renders as Section · Start · End · Length with optional
Flags / Display columns; click a row to select the region. Falls back to the
top-level fields when a format defines no sections.
- Automatic format detection by file extension and magic bytes; switch or
clear the format at any time without reopening the file. Add your own
extensions with
binaryViewer.additionalExtensions.
- Base address — point
binaryViewer.baseAddress (or a format's own
baseAddress) at 0x08000000 and every offset / address column, the status
bar and Go To read in mapped-flash addresses that match the datasheet.
- Timestamp epochs —
timestamp fields decode against unix / y2k /
gps / mac / filetime, shown in UTC or local time
(binaryViewer.timestamp.*).
- Binary search — hex (
FF 00 A5 10, ?? wildcards), text (optional
case-insensitive), UTF-8, UTF-16, bit patterns (10101010); find
next / previous / all, streamed so huge files don't block.
- Go To Offset —
0x1000, 4096, or 1000h.
- Reusable structures — define a record layout once under a top-level
structures map, then use its name as a field's or an array element's type
("type": "Sample", or "Sample[100]" for an array of them).
- Array shorthand — write any type as
<base>[<n>]: "float32[8]",
"int16[24]", "Sample[100]", "char[4]".
- Length-prefixed arrays —
countField sizes an array from a "+"-sum of
terms instead of a fixed count — each term a literal number, a top-level
constants entry, or an earlier integer field's decoded value, e.g.
"countField": "Number of Dogs + Number of Cats".
- Constants — a top-level
constants map of named, fixed values (a
number, or a "+"-separated sum of other constants) a field can reference
by name — for a size the format author picked, not one read from the file.
- Pointer-style offsets —
offsetField positions a field from a "+"-sum
of terms, same as countField, resolved as an absolute file offset — for
formats (e.g. bootloader headers) where one field stores another's byte
offset elsewhere in the file.
- Field
id — a short alternative to a field's name for referencing it
from countField/offsetField, so a long display name ("Width Detection Word") doesn't have to be retyped verbatim; referencing by name still
works.
- Array views —
"view": "20...35" renders just that slice of a big array
in the Structure view; the array's own count/size/offsets are unaffected.
- Array early-stop terminator —
"until": { "field": "next" } stops an
array once a field inside the element just parsed equals a value (default
0), for a linked-list "next" pointer — so a fixed/max count doesn't
over-report elements that were never really there.
cstring — a variable-length, terminator-scanned string whose size is
only known at parse time, with wordSize to decode byte-reversed word-packed
names (e.g. some Xilinx boot formats) and maxLength to bound the scan.
sizeAlign — rounds a structure's auto-computed size up to a fixed
boundary (e.g. 64), for record formats that pad every entry regardless of
its actual content length.
- Nested arrays in the form — a chained element type (
"int16[4][3]") is
form-editable up to 3 dimensions; deeper nesting needs the JSON tab.
- Format editor — a card per field in the same layout as Binary File
Designer's editor (type dropdown, size, endian, offset, description, and
enum / bit-range / ⚙ details that expand underneath); build arrays
(
+ Array → count → element type) and nested/reusable structures visually;
drag to reorder, duplicate a row and its subtree, move in/out, collapse;
live validation; import / export JSON.
- Generate a format from a binary — Binary Viewer: Generate Binary Format
From File scaffolds a starter JSON: a whole-file skeleton, or — from a
selection — a repeating
array (for a struct element it defines a reusable
Record and references it, so you edit one block, not thousands of fields).
It opens the JSON for you to finish by hand.
- Native VS Code look — theme variables throughout, so light, dark and
high-contrast all work.
Read-only by design in this version.
Getting started
- Right-click a binary file in the Explorer → Open With… → Binary Viewer
(or run Binary Viewer: Open With Binary Viewer). It registers as an
optional editor for
.bin .hex .img .dat .fw .rom .dump .raw .eeprom .nvram
and never takes over a file type on its own.
- It opens in Raw mode immediately — no setup needed.
- Toggle the Structure tab (or Ctrl/Cmd+Alt+S) once a format is
applied. If a format matches the file's extension or magic bytes it is
selected automatically; otherwise pick one from the Format dropdown or run
Binary Viewer: Create Binary Format.
- Click a structure field to highlight its bytes; toggle the inspector with
Ctrl/Cmd+Alt+I.
Build one visually with Binary Viewer: Create Binary Format — a form editor
with undo/redo, a live validation bar, a JSON tab and read-only preview, and a
side panel showing the expected byte layout (offsets in hex or decimal — see
binaryViewer.formatEditor.offsetBase — plus sizes and struct sizes) as you
edit, and [] / b / rsv buttons on each field to make it an array, a
bit-field, or reserved padding:

Formats are plain JSON — there is no expression language and nothing in a
definition is executed. They load from four places, in ascending priority:
builtin → global storage → binaryViewer.formatDirectories (extra
folders you point at a shared / network drive so the same formats travel to
another machine) → workspace (.vscode/binary-viewer/formats/*.json,
trusted only). A higher source shadows a lower one that collides by format
name or by file name. Set binaryViewer.showBuiltinFormats: false to drop
the shipped examples from the list. New / edited / deleted JSON anywhere is
picked up automatically; the ↻ button and Binary Viewer: Reload Binary
Formats force a rescan. While hand-editing a format .json (in any of those
locations) the editor title bar gains ✓ Validate (JSON + schema, also on
save) and ↻ Apply to open binary buttons. See
FORMAT_DEFINITIONS.md for the full schema.
{
"name": "Example Firmware",
"fileExtensions": [".fw"],
"endianness": "little",
"fields": [
{
"name": "Header",
"offset": 0,
"fields": [
{ "name": "Magic", "type": "uint32", "offset": 0, "display": "hex" },
{ "name": "Version", "type": "uint16", "offset": 4 }
]
},
{ "name": "Checksum", "type": "uint32", "offset": 20, "display": "hex" }
]
}
Commands
| Command |
Shortcut |
| Binary Viewer: Go To Offset |
Ctrl/Cmd+G |
| Binary Viewer: Search |
Ctrl/Cmd+F |
| Binary Viewer: Find Next / Previous |
F3 / Shift+F3 |
| Binary Viewer: Toggle Structure View |
Ctrl/Cmd+Alt+S |
| Binary Viewer: Toggle Sections View |
Ctrl/Cmd+Alt+M |
| Binary Viewer: Toggle Inspector |
Ctrl/Cmd+Alt+I |
| Binary Viewer: Show Field in Raw View |
— |
| Binary Viewer: Select Binary Format |
— |
| Binary Viewer: Create / Edit / Duplicate / Delete Binary Format |
— |
| Binary Viewer: Generate Binary Format From File |
— |
| Binary Viewer: Validate / Apply Binary Format File |
title-bar buttons on a format .json |
| Binary Viewer: Import / Export / Reload Binary Formats |
— |
Settings
| Setting |
Default |
Description |
binaryViewer.bytesPerRow |
16 |
Bytes per row in the raw view (8/16/32) |
binaryViewer.fieldColors.enabledByDefault |
false |
Enable Field Colors on opening a file with a format; remembered per-file choices take precedence. |
binaryViewer.fieldColors.brightness |
20 |
Byte-background intensity from 10 to 60 percent (values outside this range are clamped); updates open viewers immediately. |
binaryViewer.fieldColors.maxTags |
8 |
Maximum colored field-name tags above the Raw view; 0 hides tags. Tags follow the visible bytes and select their field when clicked. |
binaryViewer.byteGroup |
1 |
Raw-view word grouping: 1 / 2le / 2be / 4le / 4be / 8le / 8be (·LE reverses bytes so LE reads as a number) |
binaryViewer.defaultEndianness |
little |
Inspector / format default |
binaryViewer.defaultView |
raw |
Tab a file opens on (raw / structure / sections; falls back to raw with no format; last-used tab wins) |
binaryViewer.baseAddress |
"" |
Show offset / address columns relative to this base (e.g. 0x08000000); a format's own baseAddress overrides it |
binaryViewer.showInspectorByDefault |
true |
Show the inspector on open |
binaryViewer.blockSizeBytes |
65536 |
Range-read / cache granularity |
binaryViewer.cacheWindowBytes |
8388608 |
Max host-side cache per file |
binaryViewer.structure.maxArrayElements |
1000 |
Max elements rendered per array field in the Structure view (0 = no limit) |
binaryViewer.autoDetectFormat |
true |
Detect a format on open |
binaryViewer.additionalExtensions |
[] |
Extra file extensions (e.g. s19, .mot) to open in the Binary Viewer automatically |
binaryViewer.formatDirectories |
[] |
Extra folders to load format *.json from — e.g. a shared/network drive (~ and ${workspaceFolder} expand) |
binaryViewer.showBuiltinFormats |
true |
Include the built-in example formats in the dropdown + detection |
binaryViewer.timestamp.defaultEpoch |
unix |
Epoch for timestamp fields with no epoch (unix / y2k / gps / mac / filetime) |
binaryViewer.timestamp.displayUTC |
true |
Show timestamps as UTC ISO; false = host local time |
binaryViewer.maxSearchResults |
5000 |
Cap for Find All |
Documentation
Author
Devontae Reid — www.devontaereid.com ·
github.com/y0dev/binary-viewer-extension
License
MIT — see LICENSE.
| |