Hex Structs
Parse binary files at any offset with safe JSON struct templates and inspect fields in an Explorer tree next to any hex view.
What It Does
- Parses binary files at any decimal or
0x hex offset using declarative JSON struct templates (zero code execution).
- Reads only the needed byte ranges via
fs FileHandle paged reads so multi-GB files work without loading the whole file into memory.
- Displays parsed structures in the Struct View Explorer tree with field name, type, hex offset, byte size, value (hex and decimal), and enum names.
- Clicking any field reveals its offset in the Hex Editor extension (
ms-vscode.hexeditor) when installed and open, or copies the hex offset to your clipboard.
- Works alongside custom editors such as Microsoft's separate Hex Editor extension (
ms-vscode.hexeditor).
- Supports workspace templates in
.vscode/hex-structs/*.json with JSON schema validation, plus starter template generation.
Features (Free vs Pro)
| Feature |
Free |
Pro |
Parse at offset (hexStructs.parseAtOffset) with Struct View |
Included |
Included |
| Copy field value and copy hex offset |
Included |
Included |
Workspace templates (.vscode/hex-structs/*.json) + starter template |
Included |
Included |
| 5 bundled read-only templates (BMP, PNG IHDR, ELF64, ZIP Local File, WAV) |
Included |
Included |
| Bundled template library (33 total: 5 Free + 28 Pro common binary, executable, image, archive, and network formats) |
Upgrade prompt |
Included |
Save and reuse user templates across workspaces (globalStorageUri) |
Upgrade prompt |
Included |
| Parse Repeated (array of structs at stride over a count or range) |
Upgrade prompt |
Included |
| Export parsed result as JSON, CSV, or Markdown |
Upgrade prompt |
Included |
Commands
hexStructs.parseAtOffset (Hex Structs: Parse at Offset): Pick a template, enter or reuse an offset, and inspect the parsed fields in Struct View.
hexStructs.parseRepeated (Hex Structs: Parse Repeated (Pro)): Parse repeated structs at a byte stride over a count or range.
hexStructs.createTemplate (Hex Structs: Create Template from Starter): Create a starter JSON struct template in .vscode/hex-structs/ (or User Library for Pro).
hexStructs.saveUserTemplate (Hex Structs: Save Template to User Library (Pro)): Save a validated JSON template to extension global storage for reuse across workspaces.
hexStructs.exportResult (Hex Structs: Export Parsed Result (Pro)): Export the current Struct View result to JSON, CSV, or Markdown in an untitled editor.
hexStructs.copyValue (Hex Structs: Copy Field Value): Copy the selected field's value to the clipboard.
hexStructs.copyOffset (Hex Structs: Copy Field Offset): Copy the selected field's hex offset to the clipboard.
hexStructs.clearView (Hex Structs: Clear Struct View): Clear the current Struct View result.
hex-structs.enterLicense (Hex Structs: Enter License Key): Activate a Pro license key in VS Code SecretStorage.
Settings
hexStructs.defaultEndianness ("le" | "be", default "le"): Default byte order for templates that omit endianness.
hexStructs.maxDepth (number, default 16): Maximum nested struct depth cap.
hexStructs.maxArrayLength (number, default 10000): Maximum array element count cap.
hexStructs.maxParsedBytes (number, default 1048576): Maximum total bytes read in one parse operation.
hexStructs.maxNodes (number, default 200000): Maximum total parsed nodes produced in one parse operation.
hexStructs.maxRepeatCount (number, default 1000): Maximum repeated struct records parsed in Parse Repeated.
hex-structs.apiBaseUrl (string, default ""): Override the licensing API base URL (must use https://, machine-scoped).
hex-structs.webBaseUrl (string, default ""): Override the web storefront base URL (must use https://, machine-scoped).
Templates are plain JSON files placed in .vscode/hex-structs/*.json (or saved to your Pro User Library). No scripts or executable code are evaluated.
{
"id": "my-header",
"name": "My Binary Header",
"endianness": "le",
"structs": {
"Point": [
{ "name": "x", "type": "i16" },
{ "name": "y", "type": "i16" }
]
},
"fields": [
{ "name": "magic", "type": "string", "length": 4, "encoding": "ascii", "trimNull": false },
{ "name": "kind", "type": "u16", "enum": { "1": "Header", "2": "Data" } },
{
"name": "flags",
"type": "bitfield",
"baseType": "u16",
"bits": [
{ "name": "compressed", "offset": 0, "width": 1 },
{ "name": "level", "offset": 1, "width": 3 }
]
},
{ "name": "origin", "type": "struct", "structRef": "Point" },
{ "name": "payload_len", "type": "u32" },
{ "name": "payload", "type": "bytes", "length": "payload_len" },
{ "name": "pad", "type": "align", "alignment": 4 },
{ "name": "tail", "type": "u32", "offset": "payload_len + 16" }
]
}
Supported Field Types
- Integers and floats:
u8, i8, u16, i16, u32, i32, u64, i64, f32, f64, or explicit endian variants (u16le, u16be, i16le, i16be, u32le, u32be, i32le, i32be, u64le, u64be, i64le, i64be, f32le, f32be, f64le, f64be). Optional "endianness": "le" | "be" and "enum": { "0": "Name" } (decimal or 0x hex keys).
- Byte arrays:
"type": "bytes", "length": <int or expr>, optional "display": "hex" | "ascii".
- Strings:
"type": "string", "length": <int or expr>, "encoding": "ascii" | "utf8" | "utf16le", optional "trimNull": true | false.
- Nested structs:
"type": "struct" with inline "fields": [...] or "structRef": "<name>".
- Arrays:
"type": "array", "count": <int or expr>, "element": { ... }.
- Bitfields:
"type": "bitfield", "baseType": "u8" | "u16" | "u32" | "u64", "bits": [{ "name", "offset", "width", "enum"? }].
- Padding and alignment:
"type": "padding" with "length": <int or expr>, or "type": "align" with "alignment": 1..4096 and optional "alignTo": "struct" | "file".
- Offset and length expressions: Non-negative decimal or
0x hex integer constants, field references (such as payload_len or hdr.len), +, -, and parentheses.
Privacy and Data Handling
| Data |
Where |
Retention |
| Binary file slices |
Memory only during parsing |
Until next parse, clear, or window close |
| Workspace templates |
.vscode/hex-structs/*.json |
Managed by user |
| User templates |
Extension globalStorageUri on local machine |
Until deleted by user |
| Exported results |
Untitled editor |
Until saved or closed by user |
| License key, product ID, machine ID hash |
Licensing API (hex-structs.apiBaseUrl) on Pro activation and refresh |
Active license lifetime |
| Telemetry |
None |
None |
No binary file contents, file paths, or parsed results leave your machine. Telemetry is disabled (collectsTelemetry: false).
Workspace Trust
Hex Structs runs in Restricted Mode (untrusted workspaces) with limited support because templates contain no executable code. Bundled templates and user templates remain available; workspace templates under .vscode/hex-structs/*.json are disabled until you trust the workspace.
Offline Behaviour
- Parsing, template validation, user templates, and exports work completely offline with zero network calls.
- Paid licenses are verified offline using the bundled Ed25519 public key with a 14-day grace period.
Pricing
Hex Structs is free to use. Pro adds the 33-format template library (28 Pro + 5 Free), user template storage, Parse Repeated, and JSON/CSV/Markdown export.
- Pro: $4/month or $36/year
- All Access (every Toolsmith Labs extension): $12/month or $99/year
View plans and buy. After purchase, sign in to your account to copy your license key, then run Hex Structs: Enter License Key.
Support
Report issues or request help at github.com/toolsmith-labs/support.
| |