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.

What you get
- 16 / 8 / 32 bytes per row, virtualized rendering, horizontal + vertical
scroll, full keyboard navigation, hex ⟷ ASCII selection sync.
- 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": "n" sizes an array from an earlier
integer field's decoded value instead of a fixed count.
- Format editor — build fields, arrays (
+ Add Array → count → element
type), and nested/reusable structures visually; 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.
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.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.
| |