How to use the asn.1 der structure viewer
- Paste a PEM block (with its BEGIN and END lines), base64 text, or hex bytes into the box. Leave the format on Detect, or choose it yourself.
- Tick Look inside OCTET STRING and BIT STRING if you want the page to open data that is wrapped in those strings, such as certificate extensions.
- Read the table from top to bottom: each row is one element with its offset, depth, header size, content length, type and decoded value.
- Copy the table, or download the CSV, to keep a record of the structure.
Formula
element = tag byte(s) + length + content
tag byte: class (2 bits), constructed flag (1 bit), type number (5 bits, or more bytes when 31)
length: under 128 is one byte; otherwise 0x80 + number of length bytes, then the length
DER is a strict form of ASN.1 encoding. Constructed elements such as SEQUENCE and SET contain other elements, which is why the result is a tree. The page checks that writing the tree back gives the same bytes.
An elliptic curve public key
The built in sample is a 91 byte public key. The outer SEQUENCE starts at offset 0 with a 2 byte header and 89 bytes of content. Inside it, a second SEQUENCE of 19 bytes holds two object identifiers: 1.2.840.10045.2.1, shown as Elliptic curve key, and 1.2.840.10045.3.1.7, shown as P-256.
A BIT STRING of 66 bytes follows at offset 23. Its first byte says 0 bits are unused, and the other 65 bytes are the public point. The offsets, header sizes and lengths agree with what the openssl asn1parse command prints for the same bytes.
Reading the columns
Offset is the position of the element’s first byte, counting from 0. Depth is how many elements enclose it, and the arrows in the Element column show the nesting. Header is the number of tag and length bytes, and Length is the number of content bytes, so an element takes Header plus Length bytes in total.
Values are decoded when the type is known: integers as numbers, object identifiers with a name when the page recognizes them, strings as text, times as written, and other bytes as hex. Long values are cut and show how many bytes they hold.
Where DER shows up
Certificates, public keys, signing requests and many other security files are DER inside PEM armor. Looking at the raw tree helps when a tool rejects a file and you want to see which field is wrong, or when you need an object identifier in a form you can search for.
For the subject, issuer and dates of a certificate in plain language use the PEM Certificate Decoder, and to inspect the bytes of any file see the Hex Viewer for Files.
Assumptions and limits
- Only DER with definite lengths is read. Indefinite lengths from BER are refused with a message.
- Input is limited to about 64 KB and 1,500 elements, and nesting to 40 levels.
- Private key blocks are refused on purpose. Paste public data or certificates only.
- The page decodes structure and does not check signatures, dates or trust.
- Nothing typed here leaves your browser.
Frequently asked questions
What is the difference between PEM and DER?
DER is the binary encoding. PEM is the same bytes written as base64 between BEGIN and END lines, so that it can be pasted into text. The page strips the armor and reads the bytes inside.
Why does the page refuse my file?
The usual causes are an indefinite length, which DER does not allow, a length that runs past the end of the data, or text that is not base64 or hex. The message names the offset where reading stopped.
What does Look inside do?
Some elements are strings that hold more DER. With the box ticked, the page tries to read their content as one element and shows it as a child when it fits exactly. Content that is not valid DER stays as plain bytes.
Does a successful read mean the data is valid?
It means the bytes form well-formed elements. A certificate or key can be well-formed and still be expired, untrusted or the wrong type for what you need.