DER

DER (Distinguished Encoding Rules) is the binary ASN.1 encoding that X.509 certificates, CSRs and keys are actually defined in. A DER file holds exactly one object with no header, footer or delimiter of any kind, which is why several DER certificates cannot be concatenated into a chain the way PEM ones can. Every DER file of a standard type starts with byte `0x30`, the ASN.1 tag for SEQUENCE. PEM is this same binary data Base64-encoded and labelled.

Updated August 19, 2026 Verified against OpenSSL 3.5.7

What it is #

DER is the wire format. X.509 certificates are defined in ASN.1, an abstract description of data structures, and DER is one set of rules for turning that abstraction into bytes. When a certificate is signed, it is the DER bytes that get hashed — which is why the encoding must be deterministic. BER, DER’s more permissive parent, allows several valid encodings of the same value; DER allows exactly one.

The first bytes of any DER certificate
head -c 4 certificate.der | xxd
Expected output
00000000: 3082 05a1                                0...

30 is the ASN.1 tag for SEQUENCE. 82 says the length is encoded in the next two bytes. 05a1 is that length — 1441 bytes. Every standard DER file starts this way, which makes it easy to recognise.

Identifying a DER file #

file certificate.der
Expected output
certificate.der: Certificate, Version=3

Or check the first byte directly, which works without file installed:

head -c 1 certificate.der | xxd -p
Expected output
30

Reading a DER file #

Every OpenSSL subcommand takes -inform der:

Inspect a DER certificate without converting it
openssl x509 -inform der -in certificate.der -noout -text
A DER private key
openssl pkey -inform der -in private.der -noout -text

Where DER shows up in practice #

  • Certificates published by CAs. The Authority Information Access extension points at an intermediate that is nearly always DER, which is why DER to PEM is such a common conversion.
  • Windows exports. The certificate export wizard offers “DER encoded binary X.509” and writes it with a .cer extension.
  • Java keystores, PKCS#7 and PKCS#12. All three are DER-encoded containers. The container is binary even when the certificates inside it came from PEM files.
  • Constrained devices. Skipping Base64 saves about 25% of the bytes, which matters on embedded systems and not much anywhere else.

Converting #

openssl x509 -inform der -in certificate.der -out certificate.pem
openssl x509 -in certificate.pem -outform der -out certificate.der

The conversion is lossless in both directions and the fingerprint does not change, because the fingerprint is a hash of the DER bytes either way:

openssl x509 -in certificate.pem -noout -fingerprint -sha256
openssl x509 -inform der -in certificate.der -noout -fingerprint -sha256

DER compared with PEM #

DER PEM
Encoding Raw binary Base64 text
Objects per file One Many
Readable in an editor No Yes
Safe to paste into a terminal or ticket No Yes
Size ~25% smaller Larger
Typical extension .der, .cer .pem, .crt, .key
OpenSSL flag needed -inform der none (the default)

Frequently asked questions

What does DER stand for?
Distinguished Encoding Rules. It is a restricted subset of BER (Basic Encoding Rules) in which every value has exactly one valid encoding. That determinism is essential for signatures, because a certificate has to serialise identically everywhere or its signature would not verify.
Can a DER file hold a certificate chain?
Not reliably. DER has no delimiters, so concatenated certificates cannot be split apart again with any certainty. A binary file that holds several certificates is almost always PKCS#7 or PKCS#12, both of which are themselves DER-encoded containers.
How do I tell DER from PEM?
Look at the first byte. 0x30 means DER. A - character (the start of -----BEGIN) means PEM. head -c 2 file | xxd answers it in one command.
Is DER more secure than PEM?
No. They encode identical data and offer identical protection, which is to say none — neither format encrypts anything by itself. A DER private key is exactly as exposed as a PEM one.

References