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-----
  • File extensions: .pem, .crt, .cer, .key
  • Used by: Nginx, Apache, Node.js, OpenSSL, Let's Encrypt
  • Human readable: Yes (Base64 text)
  • Can contain multiple certificates in one file (certificate chain)

DER Format

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

  • File extensions: .der, .cer
  • Used by: Java applications, Android, Windows (sometimes)
  • Human readable: No (binary)
  • Smaller file size than PEM

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.

  • File extensions: .pfx, .p12
  • Used by: Windows IIS, Azure, AWS, Java keystores
  • Password protected: Yes
  • Contains: Certificate + private key + chain (all in one 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 →
N

Nattapon Tonapan

Developer & creator of FreeUtil. Building free tools for developers and Thai users.

About the author →

RELATED ARTICLES

OpenSSL & Cert8 min read

How to Create a Self-signed SSL Certificate for Local Development

OpenSSL & Cert7 min read

What is a CSR? How to Generate and Submit a Certificate Signing Request

OpenSSL & Cert7 min read

TLS 1.0, 1.1, 1.2, and 1.3: Differences and Why Versions Matter

← Back to all articles