Guide

How to Decode a PEM Certificate (X.509) Step by Step

Short answer: To decode a PEM certificate, paste the whole block, from -----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----, into the X.509 Certificate Inspector. For other PEM content such as public keys, certificate chains and mixed files, use the PEM Inspector. Both work in your browser; for certificates they show the subject, issuer, validity dates, names, key details and fingerprints. Do not paste a private key into any web page.

What PEM and X.509 are

  • X.509 is the standard format for public-key certificates, including the TLS/SSL certificates behind HTTPS. A certificate ties a public key to a name and is signed by an issuer (RFC 5280).
  • DER is the binary encoding of that structure.
  • PEM is DER converted to Base64 text (Base64 is an encoding, not encryption) and wrapped between -----BEGIN …----- and -----END …----- lines (RFC 7468). That is why a certificate looks like a block of random letters.

File extensions are only conventions:

Extension Usually contains
.pem One or more PEM blocks (certificate, key, chain)
.crt, .cer A certificate, PEM or DER
.der Binary DER
.key A private key (never share it)
.csr A certificate signing request

Common PEM labels: CERTIFICATE, CERTIFICATE REQUEST (CSR), PUBLIC KEY, PRIVATE KEY (PKCS#8), RSA PRIVATE KEY (PKCS#1), EC PRIVATE KEY, ENCRYPTED PRIVATE KEY.

Why decode a certificate

  1. Check the names before you deploy. A certificate is only valid for the names in its Subject Alternative Names (SAN). Modern browsers rely on SAN, not the Common Name. A missing www entry causes name-mismatch errors.
  2. Check the expiry date before it takes your site down.
  3. Debug a chain. Work out which certificate is the leaf, the intermediate and the root, and whether the chain is in the right order.
  4. Check a CSR before sending it to a certificate authority, so you do not get a certificate with a typo. The browser tools here identify a CSR and outline its structure; to read its subject and requested names use openssl req (see below).
  5. Compare fingerprints to confirm that two people are looking at the same certificate.
  6. Spot weak settings: short RSA keys, old signature algorithms, missing SAN.

How to decode a PEM certificate with the X.509 Certificate Inspector

  1. Open the X.509 Certificate Inspector.
  2. Paste the PEM text, or drag and drop a .pem, .crt, .cer or .der file. PEM bundles with several certificates are supported, and so is bare Base64.
  3. Read Certificates found: subject, issuer, valid-until date and state for each certificate.
  4. Open a certificate to see: - version, serial number, subject and issuer, valid-from and valid-until; - signature algorithm and public key details (RSA modulus and exponent, elliptic curve and point, Ed25519); - Subject Alternative Names (DNS, IP, email, URI), including wildcard names and internationalised names decoded from Punycode; - Key Usage, Extended Key Usage, Basic Constraints and other common extensions; - SHA-256, SHA-1 and SHA-512 fingerprints of the whole certificate, and the SHA-256 of the public key (SPKI). Fingerprints need the browser's Web Crypto, which is available on HTTPS pages.
  5. Read the factual notes, such as expired or not yet valid, MD5 or SHA-1 signatures, RSA keys shorter than 2048 bits, no Subject Alternative Name, an unrecognised critical extension, or a malformed serial number.

How to use the PEM Inspector

Use the PEM Inspector when the file might hold more than a certificate.

  1. Paste PEM text, choose a file or drop it on the page (.pem, .crt, .cer, .key, .csr, .der).
  2. It finds every block, decodes it, and reports what it is, how it is encoded and how big it is.
  3. Fully decoded: certificates (chains are listed in order) and public keys (SPKI and PKCS#1). Recognised and sized: certificate requests (CSR), CRLs, PKCS#7, DH and EC parameters. Unknown labels are also recognised and sized, with an ASN.1 outline when the data is DER.
  4. Private keys are identified only (type and size), never displayed or copied, and removed from the input box. If you pasted a real production private key anyway, treat it as exposed and replace it (the steps in what to do about a leaked secret apply).
  5. Use the search, compare and export features. Exports contain public metadata only.
  6. In the chain workspace, each certificate's signature is checked against the certificate it links to, when that certificate is in your input.

Equivalent OpenSSL commands

If you prefer the command line:

openssl x509 -in cert.pem -noout -text            # decode a certificate
openssl req  -in request.csr -noout -text         # decode a CSR
openssl x509 -in cert.pem -noout -fingerprint -sha256
openssl x509 -in cert.pem -noout -enddate         # expiry

The SHA-256 fingerprint shown by the inspector should match the one OpenSSL prints. For background on the hash functions behind fingerprints, see MD5 vs SHA-256 vs SHA-3 vs BLAKE2.

"Parsed" is not "verified"

This is the most important idea on the page. Both tools say so clearly.

  • Parsed means the bytes were read as a certificate and the fields were decoded. It says nothing about whether the certificate is genuine, who controls it, or whether you should trust it. Anyone can create a certificate with any name.
  • Verified, here, covers one narrow check: whether the certificate's signature is mathematically valid for a public key, either its own (self-signed) or an issuer certificate you included in the same input. A valid self-signature only proves the certificate is internally consistent.

Limits to know

The inspector does not:

  • build a chain to a trust store or check that a root is trusted;
  • check revocation (CRL or OCSP);
  • match the certificate to a hostname;
  • apply name constraints, path-length or policy rules;
  • check Certificate Transparency.

Validity dates are compared with your device's clock, which is an observation, not a validation. For real trust decisions, use your operating system, browser or openssl verify and your server's own TLS tests.

Other limits: in the X.509 Certificate Inspector, PKCS#7 and PKCS#12 bundles, certificate requests, CRLs and public keys are recognised and named but not decoded in detail, and encrypted private keys are identified but not decrypted. The PEM Inspector accepts up to 8 MB of input, 500 blocks and 1 MB of decoded data per block, and the browser's Web Crypto cannot check SHA-224 signatures or curves other than P-256, P-384, P-521 and Ed25519.

Frequently asked questions

How do I decode a PEM certificate? Paste the full text including the BEGIN and END lines into the X.509 Certificate Inspector.

What is the difference between PEM, CRT and DER? PEM is Base64 text; DER is binary; .crt and .cer may be either. Most tools accept both.

What is a SAN and why does it matter? The Subject Alternative Name lists the hostnames and IPs a certificate is valid for. Browsers check it, not the Common Name.

Is it safe to decode a certificate online? Public certificates contain no secrets. Use a tool that runs locally in your browser, and never paste a private key.

Why does the certificate show as expired when my server works? The tool compares dates with your device's clock. Check that your device date is correct, and check the certificate your server actually serves.

Can I decode a CSR? The PEM Inspector recognises a certificate request and shows its type, size and an ASN.1 outline, but it does not list the subject and requested names. For those, run openssl req -in request.csr -noout -text.

Related tools and guides

Sources and further reading