ssl-guides 2026-12-05 ⏱ 3 min read

SSL Certificate File Types: PEM, CRT, KEY, PFX, P7B

SSL Certificate File Types: PEM, CRT, KEY, PFX, P7B

You ask a CA for a certificate and get a zip with three files that have different extensions. Your server wants a fourth. Certificate file names are confusing because an extension tells you little: it can describe the encoding, the content, or just a habit. This guide separates the two ideas and shows which file goes where. Each server fact comes from that product's own documentation.

Two things hide behind an extension

**Encoding** is how the bytes are stored. PEM is text, base64 between -----BEGIN ...----- lines. DER is the same data in binary form. **Container** is what is inside. A file can hold a single certificate, a key, a chain of certificates, or a certificate with its key.

Because of this, .crt, .cer and .pem can all hold the same PEM certificate. The name alone does not prove it. Open the file in a text editor. If you can read BEGIN CERTIFICATE, it is PEM.

The file types

ExtensionUsually containsEncoding
.pemCertificate, key or chainText
.crt, .cerA certificatePEM or DER
.keyA private keyPEM usually
.csrA certificate signing requestPEM usually
.derA certificateBinary
.pfx, .p12Certificate, chain and private keyBinary, password protected
.p7b, .p7cCertificate and chain, no private keyPEM or DER
.jksJava keystoreJava specific

Certbot's documentation says all of its files are PEM-encoded and that if you need another format such as DER or PFX you can convert with openssl.

What each server wants

  • **Nginx and Apache** read PEM. Certbot's documentation says Nginx uses fullchain.pem as the certificate and privkey.pem as the key. See what fullchain.pem is.
  • **IIS** works with PFX for import. See how to convert PEM to PFX.
  • **Kestrel in ASP.NET Core** accepts a .pfx with a password, or a .pem or .crt with a separate .key, according to Microsoft. See the ASP.NET Core guide.
  • **Synology DSM** requires X.509 certificates in PEM or DER, and private keys in RSA or ECC format. An RSA key cannot have a passphrase. See the Synology guide.
  • **Tomcat and Spring Boot** use Java keystores such as PKCS12. See the PEM to keystore guide.
  • **CloudPanel** asks for the private key, certificate and chain as separate PEM text.

How to tell what a file holds

openssl x509 -in file.crt -noout -subject -dates
openssl x509 -in file.crt -inform DER -noout -subject
openssl pkcs7 -in file.p7b -print_certs -noout

The first works on a PEM certificate. If it fails with an error about a bad header, try the second, which reads DER. The third lists the certificates in a P7B bundle. A key file is easy to spot, because its first line says PRIVATE KEY. A key that begins with ENCRYPTED PRIVATE KEY needs its passphrase.

To check that a key belongs to a certificate, use the key matcher.

Common conversions

openssl x509 -in cert.der -inform DER -out cert.pem
openssl pkcs12 -in site.pfx -nodes -out all.pem
openssl pkcs7 -in bundle.p7b -print_certs -out chain.pem

The first turns DER into PEM. The second unpacks a PFX into one PEM file that holds the key too, so protect it. The third pulls certificates out of a P7B. The online SSL converter does the same without the command line, but never upload a private key to a tool you do not trust. More guides: PFX to PEM, CRT to PEM and P7B to PEM.

Which files are secret

Only the private key, and any PFX or P12 file, because they contain it. The certificate and chain are public by design. A CSR is not secret either, but it should match your key. Treat privkey.pem and every .pfx like a password.

Quick decision

If the file says BEGIN CERTIFICATE, a Linux server will take it. If it is binary and ends in .pfx, it is for Windows or Java. If it ends in .p7b, it is a chain without a key, and you will need your own key file.

Sources: Certbot documentation, Microsoft Kestrel documentation, Synology Knowledge Center, CloudPanel documentation and OpenSSL documentation for pkcs7.

🔄 Convert PEM Certificate to Windows .PFX Online
Convert PEM → PFX →

✅ Post-Installation Verification & SEO Checklist

After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:

  • Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
  • Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
  • Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
  • Confirm both root and www versions resolve cleanly to one canonical HTTPS URL.
  • Verify your HTTPS property and sitemap.xml inside Google Search Console and Bing Webmaster Tools.
Technically Reviewed by TryFreeSSL Security Team
Last updated: 2026-12-05
About Us →

Free SSL Certificates, Live SSL Checker & CSR Generator

Issue trusted Let's Encrypt SSL certificates in 60 seconds with zero server setup.

Related Articles

🤖 TryFreeSSL AI Assistant