DevTools Logo

ASN.1 DER/BER Decoder

ASN.1 DER/BER Decoder

Inspect Tag-Length-Value bytes with a recursive tree, OID names and a hex dump.

Runs in your browser
Try an example

Hex or PEM input

15 bytes

Spaces, commas, colons, hyphens and 0x prefixes are accepted. PEM blocks are decoded from base64.

Decoded structure

1 top-level value
  • [0] SEQUENCE (13 bytes)
    • [2] OBJECT IDENTIFIER (9 bytes): 1.2.840.113549.1.1.1 (rsaEncryption)
    • [13] NULL (0 bytes): NULL

Hex dump

00000000  30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00     |0...*.H........|

Details

Paste hexadecimal DER or BER bytes to inspect recursive SEQUENCE and SET structures, decoded OIDs, signed integers, UTC times, and an offset-based hex dump.

Examples

RSA OID prefix

Input
decodeAsn1("30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00")
Output
{ type: "SEQUENCE", children: [{ value: "1.2.840.113549.1.1.1" }, { type: "NULL" }] }

The SubjectPublicKeyInfo prefix decodes to an RSA OID plus NULL parameters.

Indefinite BER with UTCTime

Input
decodeAsn1("30 80 02 02 01 00 17 0d 32 34 30 31 30 31 30 30 30 30 30 30 5a 00 00")
Output
{ length: null, children: [{ value: contains "256" }, { value: contains "2024-01-01T00:00:00.000Z" }] }

The indefinite SEQUENCE ends at 00 00 with an integer and an ISO-converted UTC time.

About this tool

ASN.1 DER Decoder parses hex with decodeAsn1(input) (alias parseAsn1Der): toBytes accepts spaced, colon, dash, or 0x-prefixed hex, then parse walks tag, length, and value into Asn1Node entries with tagClass, constructed, depth, headerLength, byteRange, and a hexDump row table.

Primitive values decode by universal type: signed big-endian INTEGER and ENUMERATED with hex, dotted OBJECT IDENTIFIER arcs, TRUE/FALSE BOOLEAN, NULL, BIT STRING unused-bits detail, UTCTime and GeneralizedTime ISO strings with the raw text, decoded strings, and hex OCTET STRING.

BER is supported alongside DER: 0x80 indefinite lengths require constructed values and end at 00 00, while truncated tags, lengths, arcs, and values throw offset-stamped errors and repeated decodes are deterministic.

How to use this tool

  1. Paste hex

    Provide DER or BER bytes as hex pairs with any common separator.

  2. Walk the tree

    Expand constructed SEQUENCE and SET nodes by depth and byteRange.

  3. Read values

    Copy OID dotted arcs, integer decimal plus hex, and UTCTime ISO timestamps.

Use cases

Inspecting certificates

Decode SPKI, OID, and time fields when debugging X.509 payloads.

Debugging BER streams

Confirm indefinite-length framing and EOC termination in network captures.

Diagnosing truncation

Use offset-stamped errors to find cut-off tags, lengths, or values.

Common mistakes

Mistake:Pasting odd-length hex and expecting padding.

Fix:Hex must hold complete byte pairs — add the missing nibble before decoding.

Mistake:Using indefinite length on a primitive.

Fix:0x80 requires a constructed tag, so wrap the value in a SEQUENCE or SET.

Frequently asked questions

What does this tool do?

It decodes DER or BER hex with decodeAsn1 into tagged nodes with depth, byte ranges, typed values, children, and a hex dump table.

How are OIDs, times, and BER handled?

OIDs render as dotted arcs like 1.2.840.113549.1.1.1, UTCTime converts to ISO with the raw text, and 0x80 indefinite lengths decode constructed values up to the 00 00 terminator.

Is my binary uploaded or stored?

No. Hex parsing and ASN.1 tree building run fully client-side.

Why a truncated or indefinite-length error?

Cut-off tags, lengths, and values throw offset-stamped errors, and indefinite length on a primitive tag throws because only constructed values may use it.

References & standards