OpenSSL & Cert7 min read

SSL Certificate Types Explained: PEM, DER, PKCS12, and More

A complete guide to SSL certificate formats — PEM, DER, PKCS12/PFX, and PKCS8. Learn what each format is, when to use it, and how to convert between them.

SSL Certificate Formats

SSL/TLS certificates can be stored in several different file formats. Understanding the differences is essential when configuring web servers, load balancers, and application servers. The same certificate can exist in multiple formats — they contain the same information, just encoded differently.

PEM Format

PEM (Privacy Enhanced Mail) is the most common certificate format on Linux and Unix systems. It is Base64 encoded DER data wrapped between header and footer lines.

-----BEGIN CERTIFICATE-----
MIIDzTCCArWgAwIBAgIQCjeHZIR4...
(Base64 encoded data)
-----END CERTIFICATE-----

DER Format

DER (Distinguished Encoding Rules) is the binary encoding of a certificate. PEM is just DER data that has been Base64 encoded.

PKCS#12 / PFX Format

PKCS#12 (PFX) is an archive format that can store a certificate, its private key, and the entire certificate chain in a single password-protected file.

PKCS#8 Format

PKCS#8 is a standard syntax for storing private key information. It can store RSA, DSA, EC, and other key types, optionally encrypted with a passphrase.

-----BEGIN PRIVATE KEY-----        (unencrypted)
-----BEGIN ENCRYPTED PRIVATE KEY-- (encrypted)
-----END PRIVATE KEY-----

Format Conversion Commands

ConversionOpenSSL Command
PEM → DERopenssl x509 -in cert.pem -outform DER -out cert.der
DER → PEMopenssl x509 -in cert.der -inform DER -out cert.pem
PEM → PFXopenssl pkcs12 -export -out bundle.pfx -inkey key.pem -in cert.pem
PFX → PEMopenssl pkcs12 -in bundle.pfx -out cert.pem -nodes

✓ Quick rule: Use PEM for Linux servers (Nginx, Apache, Node.js). Use PFX/PKCS12 for Windows IIS and Java. Use DER when required by specific applications.

TRY THE FREE TOOL

PEM ↔ DER Converter

Convert SSL certificates between PEM and DER formats

Open Tool →
← Back to all articles