Introduction
ASN.1 (Abstract Syntax Notation One) is a standard for describing structured data defined by ITU-T X.680, and DER (Distinguished Encoding Rules, X.690) is its canonical binary encoding. ASN.1/DER is the foundation of X.509 certificates, PKCS#8 private keys, CSRs, CRLs, and many TLS and PKI artifacts. This tool decodes DER or BER encoded ASN.1 into a structured tree with tag class, tag number, length, and value, entirely in your browser.
What this tool does
- Parses DER or BER encoded ASN.1 from hex, base64, or PEM input.
- Renders a structured tree showing tag class, tag name, length, and value.
- Identifies universal tags (SEQUENCE, INTEGER, OCTET STRING, OID, etc.) and constructed flags.
- Produces an ASCII dump of the parsed structure for quick inspection.
- Processes all data locally in your browser with no network requests.
How this tool works
Pick an input format (hex, base64, or PEM) and paste your data. The tool converts the input to a byte array and calls the asn1js `fromBER` parser, which walks the TLV (tag-length-value) stream and builds an in-memory tree. The tree is rendered as an indented list with the tag class (UNIVERSAL, APPLICATION, CONTEXT-SPECIFIC, PRIVATE), the tag name (for universal tags), the constructed flag, the length, and a hex or string value preview. An ASCII dump is also produced for quick scanning. All computation runs client-side.
How ASN.1 and DER work
ASN.1 was first defined in 1984 by CCITT (now ITU-T) and is specified in the X.680 series. DER is one of several encoding rules defined in X.690; it is a restricted form of BER (Basic Encoding Rules) that guarantees a single canonical encoding for each value, which is essential for digital signatures. Every ASN.1 value is encoded as a triple: a tag byte (class, constructed flag, tag number), a length (short form for < 128 bytes, long form otherwise), and the value bytes. Constructed types such as SEQUENCE and SET contain nested TLVs. X.509 certificates (RFC 5280) are a SEQUENCE of three elements: tbsCertificate, signatureAlgorithm, and signatureValue. PKCS#8 private keys (RFC 5208) wrap the algorithm-specific key in a SEQUENCE with a version and algorithm identifier.
How to use this tool
- Pick an input format: Hex, Base64, or PEM.
- Paste your DER or BER encoded data, or click Load sample to try a tiny SEQUENCE.
- The decoded tree appears instantly with tag, length, and value for each node.
- Use Copy on the ASCII dump to copy the textual representation.
- Change the input or format at any time; the tree updates automatically.
Real-world examples
Inspecting a tiny SEQUENCE
Input (hex): `300602012a16024869`. The tree shows `SEQUENCE (constructed)` containing `INTEGER 42` and `IA5String Hi`, demonstrating nested TLV parsing.
Decoding an X.509 certificate
Input (PEM): `-----BEGIN CERTIFICATE-----...`. The tree shows the outer SEQUENCE with the tbsCertificate, signatureAlgorithm, and signatureValue, and you can drill into the subject, issuer, and public key.
Decoding a PKCS#8 private key
Input (PEM): `-----BEGIN PRIVATE KEY-----...`. The tree shows the version, algorithm identifier (e.g. rsaEncryption 1.2.840.113549.1.1.1), and the octet-string-wrapped RSA key.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| DER | O(n) — single canonical pass | X.509 certificates, PKCS#8 keys, CSRs, signatures |
| BER | O(n) — multiple valid encodings | LDAP, SNMP, CRL entries, indefinite-length streams |
| CER | O(n) — canonical but uses indefinite length | Large ASN.1 structures, security data |
| JSON | O(n) — text-based | Web APIs, JWK, configuration files |
Limitations or considerations
This tool decodes the ASN.1 structure but does not interpret the semantics of every known OID or algorithm-specific key format. For RSA keys, use the PEM Key Parser tool on this site to extract the modulus, exponents, and primes. For very large inputs (multi-megabyte certificates or CRLs) parsing may be slow. The parser accepts BER, which is a superset of DER, so non-canonical encodings will parse but may not round-trip to the exact same bytes.
Frequently asked questions
What is the difference between BER, DER, and CER?
BER (Basic Encoding Rules) is the most permissive and allows multiple encodings of the same value. DER (Distinguished Encoding Rules) restricts BER to a single canonical encoding, which is required for digital signatures. CER (Canonical Encoding Rules) is another canonical form that uses indefinite-length encoding for large structures.
Why is DER used for X.509 certificates?
Because digital signatures require a canonical byte representation. If two encodings of the same certificate were valid, the signature on one would not verify against the other. DER guarantees a single encoding per value.
Can this tool validate a certificate chain?
No. This tool only decodes the ASN.1 structure. To validate a chain you need to verify signatures, check validity dates, and walk the issuer chain, which is out of scope for a decoder.
What does the ASCII dump show?
The ASCII dump is the asn1js `toString('ascii')` output, which renders each node as `SEQUENCE { INTEGER 42, IA5String 'Hi' }` style text. It is a quick way to scan the structure without reading the tree.
Conclusion
The ASN.1/DER decoder gives you a fast, browser-based way to inspect the structure of X.509 certificates, PKCS#8 keys, CSRs, and any other ASN.1/DER encoded data. With hex, base64, and PEM input, a structured tree view, and a fully client-side implementation, it is a handy tool for debugging TLS and PKI artifacts without installing OpenSSL.