— Developer Tools

Free ASN.1 DER Decoder

Paste a PEM certificate, a key, or DER bytes as hex or Base64, and read every tag, length and value as a tree.

— Samples
Bytes 501Elements 70Read as PEMValid
Live

What is an ASN.1 DER Decoder?

ASN.1 is the notation behind X.509 certificates, private keys, certificate requests and many network protocols, and DER is the binary encoding they use on disk and on the wire. This decoder turns those bytes into a readable tree of types and values.

It follows ITU-T X.690, reading every tag, length and value, and names 46 common object identifiers from X.509, PKCS and CMS. DER mode enforces the strict rules certificates need, while BER mode also reads the looser encoding found in CMS and PKCS #7 messages.

Key Features

PEM, Base64 or Hex

Paste a certificate block with its BEGIN and END lines, bare Base64, or hex with any spacing. A whole chain of PEM blocks decodes in one go.

Object Identifiers Named

OIDs such as 1.2.840.10045.2.1 show their names, here id-ecPublicKey, using OpenSSL’s naming. Algorithms, curves, name attributes and extensions are all covered.

Extensions Unwrapped

Certificate extensions and public keys hide DER inside OCTET and BIT STRINGs. The decoder opens them, so basicConstraints and subjectAltName show their contents.

Strict DER Checks

DER mode rejects indefinite lengths, oversized lengths, padded INTEGERs and BOOLEANs other than 00 or FF. Errors name the rule and the byte offset.

Certificates Stay Private

Decoding runs inside the browser tab and nothing is uploaded. Internal certificates and test keys don’t leave your computer.

Perfect for everyone

  • Security and PKI engineers
  • Developers debugging TLS and signing code
  • Sysadmins checking certificates and CSRs
  • Students learning how ASN.1 is encoded

How to Use the ASN.1 DER Decoder

Paste the data, pick strict DER or lenient BER, and read the tree.

1

Paste a PEM Block, Base64 or Hex

Copy a certificate, CSR or key file including its BEGIN and END lines, or paste DER as Base64 or hex. The Read as stat confirms which form was detected.

2

Choose DER or BER

Use DER for certificates, keys and CSRs, where only the strict encoding is valid. Choose BER for CMS, PKCS #7, LDAP or SNMP data that uses indefinite lengths.

3

Read the Tree and the Table

The tree shows each element indented under its parent, with names for OIDs and dates for times. The table adds the byte offset and content length of every element, matching openssl asn1parse.

4

Fix the Byte the Error Names

If decoding fails, the error states the rule that was broken and the offset of the element. Correct that byte in your encoder, or switch modes if the file is BER.

Worked Examples

DER and BER Bytes, Decoded

These are the building blocks of a certificate, plus two encodings strict DER refuses. The answers are the decoder’s own output in the mode on each chip, so read the bytes first and then check.

REF_001SEQUENCE

“30 07 02 01 2A 0C 02 6F 6B”

REF_002Algorithm OID

“06 09 2A 86 48 86 F7 0D 01 01 0B”

REF_003Distinguished name

“30 16 31 14 30 12 06 03 55 04 03 0C 0B 65 78 61 6D 70 6C 65 2E 63 6F 6D”

REF_004UTCTime

“17 0D 32 36 31 30 32 35 30 30 30 30 30 30 5A”

REF_005Extension, nested DER

“30 0F 06 03 55 1D 13 01 01 FF 04 05 30 03 01 01 FF”

REF_006Version tag [0]

“A0 03 02 01 02”

REF_007Negative INTEGER

“02 01 FF”

REF_008BER, indefinite length

“30 80 02 01 05 00 00”

REF_009Same bytes, DER

“30 80 02 01 05 00 00”

REF_010Cut-off element

“30 05 02 01”

Tag Guide

The ASN.1 Types in Certificates and Keys

A handful of universal types make up nearly every certificate, key and signature. The first byte of each element tells you which one you are looking at.

01 / SEQUENCE

SEQUENCE, Tag 30

An ordered list of fields and the backbone of every certificate, key and signature. Its 0x20 bit marks it as constructed, which is why the byte is 30 rather than 10.

“Which byte starts a SEQUENCE?”

02 / SET

SET, Tag 31

An unordered collection. In an X.509 name, each relative distinguished name is a SET holding one attribute, and DER sorts SET OF contents so the encoding is unique.

“Which byte starts a SET?”

03 / INTEGER

INTEGER, Tag 02

Big-endian two’s complement, so a positive value whose top bit is set gets a leading 00. Serial numbers, RSA moduli and ECDSA signature halves are all INTEGERs.

“How is 128 encoded?”

04 / OBJECT

OBJECT IDENTIFIER, Tag 06

A dotted path of arcs naming an algorithm or attribute. The first two arcs share one byte as 40 × first + second, so 2A means 1.2.

“Which OID is 55 04 03?”

05 / BIT

BIT STRING, Tag 03

Its first content byte counts the unused bits at the end, normally 0. Public keys and signatures are stored as BIT STRINGs.

“What does the 00 after 03 42 mean?”

06 / OCTET

OCTET STRING, Tag 04

Raw bytes, such as key identifiers and hashes. Certificate extensions wrap their DER value in one, which this decoder unwraps for you.

“What wraps an extension’s value?”

07 / TEXT

Text Strings, Tags 0C, 13 and 16

UTF8String, PrintableString and IA5String hold names, email addresses and domains. PrintableString allows only letters, digits, spaces and a few punctuation marks.

“Which tag marks a UTF8String?”

08 / UTCTIME

UTCTime and GeneralizedTime, Tags 17 and 18

UTCTime has two-digit years covering 1950 to 2049, while GeneralizedTime has four. RFC 5280 requires GeneralizedTime for certificate dates in 2050 or later.

“Which year is UTCTime year 49?”

09 / BOOLEAN

BOOLEAN and NULL, Tags 01 and 05

DER allows a BOOLEAN to be only 00 for false or FF for true. NULL is 05 00 with no content, often seen as an algorithm’s empty parameters.

“How does DER write TRUE?”

10 / CONTEXT

Context Tags, A0 and Up

Bytes A0 to BF and 80 to 9F are context-specific tags, whose meaning depends on the surrounding structure. In a certificate, [0] holds the version and [3] the extensions.

“What does A0 mean at the start of a certificate’s fields?”

DER, BER and PEM Explained

One notation, several byte layouts. Knowing which one a file uses tells you which mode to pick.

DER: One Encoding per Value

Distinguished Encoding Rules allow exactly one byte form for each value, which keeps signatures over certificates stable. X.509 certificates, CSRs and most keys are DER.

BER: The Flexible Parent

Basic Encoding Rules allow indefinite lengths, longer-than-needed lengths and constructed strings. CMS and PKCS #7 messages, including S/MIME email, are often BER.

PEM: DER in Base64

PEM wraps DER in Base64 between BEGIN and END lines, as RFC 7468 defines. Paste a full chain and each block is decoded one after another.

PKCS #8 and SEC1 Private Keys

BEGIN PRIVATE KEY is PKCS #8, a SEQUENCE that names the algorithm, while BEGIN EC PRIVATE KEY is the older SEC1 form. Both decode here, but explore them with test keys only.

CER, PER and XER Are Different

Canonical, packed and XML encoding rules are separate standards with their own byte layouts. This decoder reads only BER and its DER subset.

Offsets Match openssl asn1parse

The Offset column counts bytes from the start of the decoded data, the same numbers openssl asn1parse prints. Pass one to its -strparse option to dig into that element.

ASN.1 Decoding Mistakes

Most confusing results come from the wrong mode, a sign bit, or a guess about what an OCTET STRING contains.

Tip 01

Don’t Paste Production Private Keys

Decoding is local, but a key pasted anywhere can leak through clipboard history or screen sharing. Explore key formats with throwaway test keys.

Tip 02

Strict DER Rejects BER Files

A CMS or PKCS #7 file with indefinite lengths fails in DER mode, as it should. Switch to BER to read it.

Tip 03

Integers Carry a Sign Bit

A serial or modulus whose first byte is 80 or higher needs a leading 00, or it reads as negative. A missing 00 is a classic encoder bug.

Tip 04

UTCTime Years Wrap at 2050

Two-digit years 50 to 99 mean 1950 to 1999. A certificate expiring in 2050 or later has to use GeneralizedTime instead.

Tip 05

Unwrapped Strings Are a Best Guess

When the bytes inside an OCTET STRING happen to form valid DER, they are shown as a tree. A random hash rarely does, but if a nested tree looks meaningless, trust the hex.

Tip 06

Keep the PEM Block Intact

Lines such as Bag Attributes from openssl pkcs12 sit outside the BEGIN line and are ignored. Anything that isn’t Base64 inside the block makes it fail.

Tip 07

Each Name Part Is Its Own SET

A subject is a SEQUENCE of SETs, each holding one OID and value, so a five-part name has five SETs. Count SETs, not SEQUENCEs, to count name parts.

Tip 08

Captured TLS Data Has Extra Lengths

A TLS Certificate message wraps each certificate in its own three-byte length fields. Start your paste at the 30 82 that opens the certificate itself.

When to Decode ASN.1 by Hand

Whenever a certificate, key or protocol message needs a closer look than a summary view gives.

Inspecting a TLS Certificate

Paste a PEM certificate to see its subject, issuer, validity dates, key type and every extension, with each OID named.

Checking a CSR Before Submitting

Confirm that a certificate signing request carries the subject alternative names and key type your certificate authority expects.

Telling Key Formats Apart

Distinguish PKCS #1, PKCS #8 and SEC1 keys by their structure, and check the curve OID on an EC key. Use test keys for this.

Debugging ECDSA Signatures

A DER-encoded ECDSA signature is a SEQUENCE of two INTEGERs, r and s. Decoding it shows whether an encoder added or dropped a leading 00.

Reading LDAP, SNMP and Kerberos Messages

These protocols use BER or DER encoded ASN.1 as well. Paste a captured message in BER mode to see its tags and values.

Learning How ASN.1 Encodes

Change one byte of a sample and watch the tree or the error respond. Tags, lengths and values become concrete within minutes.

Testing Your Own Parser

Hand-build edge cases such as non-minimal lengths or padded INTEGERs and confirm your parser rejects them the way strict DER requires.

Frequently Asked Questions