← Back to Blog
certificates

Convert PEM to PFX (PKCS#12) and Between SSL Certificate Formats (2026)

SSL certificates come in multiple file formats, and different platforms require different formats. Apache and Nginx use PEM (separate .crt and .key files). Microsoft IIS, Azure, and load balancers typically require PFX (PKCS#12), which bundles the certificate, chain, and private key into a single password-protected file. Java applications use JKS keystore format. All conversions can be done with OpenSSL.

🔄

SSL Converter

Convert PEM to PFX, DER, P7B and back — free online, no upload needed.

Try It Free →

Converting Certificates on macOS

macOS Terminal / Keychain

macOS Terminal includes LibreSSL (OpenSSL-compatible) — all the conversion commands shown in this guide work without modification. For formats that require newer OpenSSL features, install via Homebrew: brew install openssl.

# PEM to PFX/P12 — identical to Linux: openssl pkcs12 -export \ -out yourdomain.pfx \ -inkey yourdomain.key \ -in yourdomain.crt \ -certfile yourdomain.ca-bundle # PFX to PEM — extract cert and key: openssl pkcs12 -in yourdomain.pfx -nokeys -out certificate.crt openssl pkcs12 -in yourdomain.pfx -nocerts -nodes -out private.key # PEM to DER: openssl x509 -outform der -in yourdomain.crt -out yourdomain.der # DER to PEM: openssl x509 -inform der -in yourdomain.der -out yourdomain.crt

Import a PFX into macOS Keychain

To install a certificate on macOS for use in Safari, system apps, or Homebrew servers:

# Import PFX into macOS login keychain: security import yourdomain.pfx -k ~/Library/Keychains/login.keychain-db -P "yourPassword" # Import PFX into System keychain (all users): sudo security import yourdomain.pfx -k /Library/Keychains/System.keychain -P "yourPassword" # Trust the certificate for SSL: sudo security add-trusted-cert -d -r trustRoot \ -k /Library/Keychains/System.keychain yourdomain.crt # Or simply double-click the .pfx file in Finder to open Keychain Access # and import it interactively

Verify your certificate after conversion

After converting and installing your certificate, check it's properly installed and the chain is complete.