FormatterHQ

ASN.1 Decoder

Paste a PEM block, Base64 or hex, or upload a binary file, and see the ASN.1 structure as an indented tree with OID names, decoded strings and dates.

Input TEXT
Output TEXT
Ready.

How to use the ASN.1 Decoder

  1. Paste a PEM block, a Base64 string or hex bytes, or upload a binary DER file such as a .der, .cer or .p7b.
  2. Tick Show byte offsets if you want the byte position of every element.
  3. Click Decode ASN.1.
  4. Read the tree: indentation shows nesting, and each line gives the type and its decoded value.

Inspect any structure with this ASN.1 decoder

Certificates, CSRs, private keys, PKCS#7 bundles, timestamps and many smart-card formats are all ASN.1 data encoded with DER or BER. This ASN.1 decoder parses those bytes and prints them as an indented tree, so you can see exactly what a file contains even when no specialized tool understands it. It shows the same kind of view as openssl asn1parse -i, with object identifiers translated to names.

What is ASN.1?

ASN.1 (Abstract Syntax Notation One) is a language for describing data structures. DER and BER are the binary encodings of those structures. Every element is a TLV: a tag saying what it is (SEQUENCE, INTEGER, OBJECT IDENTIFIER…), a length, and the value. Constructed elements such as SEQUENCE and SET contain other elements, which produces the tree you see in the output. PEM is simply DER wrapped in Base64 with BEGIN and END lines.

Example

The first lines of a decoded X.509 certificate:

# CERTIFICATE (639 bytes)
SEQUENCE (3 elem)
  SEQUENCE (8 elem)
    [0] (1 elem)
      INTEGER 2
    INTEGER (160 bit) 0a0260412a723b0e74659ffd7f9008309d08d5d9
    SEQUENCE (1 elem)
      OBJECT IDENTIFIER 1.2.840.10045.4.3.2 ecdsa-with-SHA256
    SEQUENCE (5 elem)
      SET (1 elem)
        SEQUENCE (2 elem)
          OBJECT IDENTIFIER 2.5.4.6 countryName
          PrintableString "US"

With Show byte offsets ticked, an EC public key looks like this:

    0: SEQUENCE (2 elem)
    2:   SEQUENCE (2 elem)
    4:     OBJECT IDENTIFIER 1.2.840.10045.2.1 ecPublicKey
   13:     OBJECT IDENTIFIER 1.2.840.10045.3.1.7 prime256v1 (P-256)
   23:   BIT STRING (520 bit) 0426ba1c38c541decd2c443fdbe5e85162043f35…

How values are shown

  • OBJECT IDENTIFIER: dotted form plus a name for common algorithms, attributes and extensions.
  • INTEGER: small numbers in decimal. Large ones, like serial numbers and RSA moduli, show their bit length and hex digits.
  • Strings: UTF8String, PrintableString, IA5String, BMPString and others are decoded to text in quotes.
  • UTCTime and GeneralizedTime: converted to ISO 8601 dates.
  • BIT STRING and OCTET STRING: when the content is itself valid DER, as with certificate extensions or a PKCS#8 private key, it is decoded in place and marked "encapsulates". Otherwise the hex is shown, shortened with "…" when long.
  • Context tags: shown as [0], [3] and so on. Their meaning depends on the surrounding structure.

BER indefinite-length encoding, used by some PKCS#7 and CMS files, is also parsed.

Common errors and fixes

  • "Length … runs past the end of the data": the data is truncated, or it is not DER at all. Check that the whole PEM block or file was copied.
  • "trailing byte(s) after the first element": the input holds extra data after one complete structure, such as two concatenated DER files.
  • "This PEM block is encrypted": legacy encrypted keys (Proc-Type: 4,ENCRYPTED) must be decrypted with openssl first.
  • Uploaded file fails to parse: PEM text files and binary DER files are both detected automatically, so a failure usually means the file is truncated or not ASN.1 at all (for example a ZIP archive or a Java .jks keystore).
  • Hex not recognized: hex input is detected when it starts with 30, the SEQUENCE tag. Other hex strings are read as Base64, so convert them to PEM or Base64 first.

For a friendlier, field-by-field view of certificates and requests, use the certificate decoder or the CSR decoder. To turn PEM into raw bytes, try PEM to DER.

Privacy

Decoding is done by a small ASN.1 parser that runs in your browser. Files and pasted data are never uploaded, which matters when you are inspecting private keys.

Frequently asked questions

What is the difference between DER and BER?
BER allows several encodings of the same value, such as indefinite lengths. DER is a strict subset with exactly one valid encoding, which is required for anything that gets signed, like certificates. This decoder reads both.
Can I decode a private key with the ASN.1 decoder?
Yes. PKCS#1, SEC1 and PKCS#8 keys are plain ASN.1, so you will see the version, algorithm and key integers. Because the key is shown in full, only do this on a machine you trust. The data is not uploaded.
Why are some OIDs shown without a name?
The decoder has a built-in table of common OIDs for algorithms, name attributes and certificate extensions. Vendor-specific or rare OIDs appear in dotted form only, and you can look them up in an OID registry.
Is this the same as openssl asn1parse?
The idea is the same: an indented dump of the TLV structure with optional offsets. This tool also decodes nested BIT STRING and OCTET STRING contents automatically and shows times as ISO dates.
Can it decode a PKCS#7 or .p7b certificate bundle?
Yes. Upload a binary .p7b file or paste its PEM block and you will see the SignedData structure, including each embedded certificate as a nested SEQUENCE.

Last updated September 26, 2026

Related tools

CSR Decoder Decode a PKCS#10 certificate signing request to check the subject, SANs, key size and signature before you send it to a CA. MongoDB ObjectId to Timestamp Extract the creation date from MongoDB ObjectIds and see the random and counter parts; also builds a date-range _id query. SAML Response Decoder Decode Base64 or deflated SAMLResponse and SAMLRequest messages into readable XML and summarise issuer, NameID, conditions and attributes. Snowflake ID Decoder Convert Twitter/X, Discord, Instagram and other Snowflake IDs to timestamps and show worker, process and sequence bits. ULID Decoder Decode ULIDs to their embedded timestamp and random part, and convert between ULID and UUID formats. SSL Certificate Decoder (X.509) Decode PEM or DER X.509 SSL/TLS certificates: subject, issuer, SANs, validity, key type, extensions and SHA-256 fingerprints. Atbash Cipher Encode and decode the Atbash cipher, which mirrors the alphabet (A↔Z, B↔Y). Running it twice returns the original text. Base32 Decode Decode Base32 strings back to text. Padding is optional and lowercase input is accepted. Base32 Encode Encode text to Base32 (RFC 4648) using the A–Z and 2–7 alphabet, with optional padding. Base58 Decode Decode Base58 strings (Bitcoin, Flickr or Ripple alphabet) back into readable text. Base58 Encode Encode text to Base58 with the Bitcoin, Flickr or Ripple alphabet — no 0, O, I or l characters. Binary to Text Translate binary code (groups of 8 bits) back into readable text, with UTF-8 support.