SSL File Extensions Explained: PEM, CRT, CER, PFX and More

Summarize this article with AI:

Table of Contents

SSL file extensions are the endings on certificate files, such as .pem, .crt, .cer, .p7b and .pfx. An extension hints at what a file holds, but it does not prove the format. Two files with the same ending can use different encodings, so check the content before you install anything.

What Is the Difference Between PEM and DER?

PEM and DER are two ways to encode the same certificate. PEM is plain text with BEGIN and END lines. DER is binary and shows no readable text. SSL.com notes that a file name alone does not tell you which one you have. Look inside the file.

Many tools accept either form, but some servers want only one. Our table below lists the extensions you will meet in both.

Which SSL File Extensions will You Meet?

Ten endings cover most cases. Some hold only a public certificate. Others hold a request or a chain, and a few can carry a private key. The table separates them by content, so you can see at a glance which file is safe to share.

ExtensionWhat it holdsPrivate key?Usual use
.pemCertificate, chain or key in Base64 textSometimesLinux servers and conversions
.crtOne certificate, usually PEM textNoServer and CA certificates
.cerOne certificate, PEM or DERNoWindows and Java tools
.derOne certificate in binaryNoJava and some devices
.keyA private key, usually PEM textYesServer configuration
.csrA certificate requestNoSent to the CA
.p7b / .p7cA certificate chain, no keyNoImporting chains
.pfx / .p12Certificate, chain and private keyYesWindows, IIS and backups

The private-key column follows DigiCert's file format reference. It says only .pfx or .p12 keeps full private key functionality on export.

Are .crt and .cer the Same?

Usually, yes. Both hold a single public certificate, so either one installs the same way. The real difference is the encoding inside, because .cer can be PEM or DER while .crt is most often PEM. Windows tools often show .cer, and Linux guides often use .crt.

If a tool rejects a file after you rename it, the encoding is the cause, not the label. Our comparison of .cer and .crt files shows both cases.

How can You Check a File's Real Format?

Open the file or run a short command, and ignore the ending. A PEM file starts with a BEGIN line, while a DER file is binary. On Linux, the file command names many formats directly, as the test below shows.

File command output for PEM and DER files

Real output from a test certificate: the file command separates PEM text from DER binary.

The test used a self-signed certificate made with OpenSSL 3.0.13. We then saved the same certificate once as PEM and once as DER, so the only change was the encoding.

Which Files Hold a Private Key?

Only a few do. A .key file holds the private key, and a .pfx or .p12 bundle carries it with the certificate. A .pem file can hold a key too, so open it before you share it. Treat every one of these as a secret.

A .crt, .cer, .csr or .p7b file never needs the key. Those files are safe to send to a CA or a colleague.

Terminal output for key CSR PKCS7 and PFX files

Real output from the same test: header lines for the key, request and chain, and a PFX shown as plain data.

Which Format Does Each Platform Want?

The server decides the format, so check it before you convert. NGINX and Apache want PEM files, with the key kept separate. However, Microsoft IIS and Azure want one PFX file that carries the certificate, chain and private key together.

PlatformFormatFiles needed
NGINXPEMCertificate with chain, plus private key
ApachePEMCertificate, chain and private key, separate
Microsoft IISPFXOne file with certificate, chain and key
Microsoft AzurePFXOne file
AWS (ELB, CloudFront)PEMCertificate, chain and key, uploaded separately

This list follows DNSimple's certificate formats guide, last updated October 2026. For the IIS side, see our steps to import and export a PFX file in IIS.

What Happens If You Open the Wrong File Type?

Opening a file with the wrong command usually gives a short error, and the message tells you what went wrong. We ran the same OpenSSL certificate command against each test file. The results below were captured on OpenSSL 3.0.13, and older versions can behave differently.

File given to openssl x509ResultMeaning
server.derPrinted the subjectOpenSSL 3 read the DER file without extra flags
server.keyUnable to load certificateA key file is not a certificate
server.pfxAsked for a pass phrase, then Could not read certificateA PFX needs the pkcs12 command and its password

Older guides tell you to add -inform der for binary files. That is still safe, but OpenSSL 3.0.13 did not need it for our test file.

How Do You Convert Between Formats?

OpenSSL converts most formats in one line. Each command below was run against the test certificate and produced a valid file. Swap in your own file names before you run them. Keep the private key out of any shared folder, and delete test copies afterwards.

openssl x509 -in server.crt -outform der -out server.der
openssl crl2pkcs7 -nocrl -certfile server.crt -out server.p7b
openssl pkcs12 -export -out server.pfx -inkey server.key -in server.crt

The first line makes DER from PEM, and the second builds a chain file. Finally, the third bundles the key and certificate, so see OpenSSL commands to check a certificate for more.

Frequently Asked Questions

Is .pem the same as .crt?

Often they hold the same PEM text. The difference is only the label. A .pem file may also contain a chain or a key, so open it to be sure.

Are .pem and .key the same?

No. A .key file holds a private key. A .pem file is a text container. It can hold a certificate, a chain or a key, so open it before you share it.

What is the typical file extension for an SSL certificate?

Most certificates use .crt, .cer or .pem. The ending is only a label, so check the content to confirm the format.

Can you rename .cer to .crt?

You can, but renaming changes only the label. It works when both files are PEM. If one is DER, convert it with OpenSSL first.

What is the difference between .pfx and .p12?

They describe the same PKCS#12 bundle. DigiCert lists them together as Personal Information Exchange Format, and tools accept either ending.

Does a .p7b file contain a private key?

No. A .p7b file holds certificates only, usually a server certificate with its chain. DigiCert states that it does not store private keys.

What is a .csr file?

A certificate signing request. It carries your public key and details and goes to the CA. It is not a certificate, and it holds no private key.