Skip to content
Aarrange

PEM to PFX

Paste a certificate, the chain and the private key, type a password and get one PFX file. Nothing leaves your browser.

Also: All formats, PFX to PEM, CRT to PEM, P7B to PEM

0
Certificates
0
Keys
0
Errors
Tab types a tab. Press Escape, then Tab, to leave the editor.
Result
The result shows here as you type.Try or .
On this page

Quick answer

Paste the certificate and the CA chain above, and the key in the Private key tab. Type a password and press Download.

With openssl
openssl pkcs12 -export -out cert.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem

About PEM to PFX

Updated

What does a PEM to PFX converter do?

Your CA sends the certificate as PEM text, in a .pem, .crt or .cer file. The private key is in another file, made with your CSR. IIS, Exchange, Azure and Windows want both in one PFX file (PKCS #12), locked with a password. This page joins them.

Before it makes the PFX, it checks that the key belongs to the certificate. A PFX with the wrong key does not work on the server. Here you see the problem before you install anything. The key and the password stay in your browser.

How to use this tool

  1. Paste your certificate and the CA chain, or drop the .crt, .cer and .ca-bundle files. The order does not matter: the tool sorts them.
  2. A private key can go in the same box or in the Private key tab. The tool finds which key belongs to which certificate.
  3. You can add several files. Pick them all at once in File, or drop them together. A file you add later goes below the text that is there: it does not replace it. A .key file goes to the Private key tab by itself. Clear empties the editor.
  4. Pick the format in To. For a PFX, type the password in the Password field. On a wide screen, To and Password are next to Convert. On a smaller screen, they are under Options, and on a phone under More.
  5. Copy the text, or press Download to save the file. A PFX or DER file downloads as a real binary file, ready to import.
What to paste
-----BEGIN CERTIFICATE-----
(your certificate)
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
(the CA certificate)
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
(your private key)
-----END PRIVATE KEY-----

An encrypted key (BEGIN ENCRYPTED PRIVATE KEY) works too. Type its password in the Password field. The PFX gets the same password.

The same tool, set up for other jobs: SSL Converter (all formats), PFX to PEM, CRT to PEM, P7B to PEM.

Common PEM to PFX errors

No private key

A PFX for IIS or Azure needs the private key. On this page, certificates without a key give the error No private key. Paste the key you made with your CSR in the Private key tab. If the key is lost, ask the CA to issue the certificate again with a new CSR.

For a PFX with certificates only, such as for a trust store, use the SSL Converter.

The key does not belong to the certificate

A PFX must hold the private key of its certificate. A key from an old CSR, or from another server, does not work with the certificate, and the server cannot use the PFX. The tool compares the public part of the key with the certificate. When they differ, it stops and shows which key and which certificate:

Invalid
-----BEGIN CERTIFICATE-----
(shop.example.com, made from CSR 1)
-----END CERTIFICATE-----
-----BEGIN PRIVATE KEY-----
(the key of CSR 2)
-----END PRIVATE KEY-----

Find the key you made with the CSR for this certificate. On the server, it is often in the same folder as the old certificate. With openssl, the two lines below print the same hash when the key fits:

Fixed
openssl x509 -in cert.pem -noout -pubkey | openssl sha256
openssl pkey -in privkey.pem -pubout | openssl sha256

A PFX with no password

When the Password field is empty, the tool makes a PFX with an empty password and shows a warning. Anyone with the file can then read the private key. Type a password before you download a file that you store or send.

A broken line in the PEM text

Copy and paste can change a character, drop a dash or cut the END line. The tool marks the exact line and column, and says what it found. When the tool can repair the text, the error card has a Fix PEM button. It puts back the five dashes and the END line, changes \n written as text to real line breaks, and wraps the Base64 at 64 characters. Fix PEM cannot repair a wrong character in the Base64. For that, copy the certificate again from the mail or portal of your CA.

Invalid
----BEGIN CERTIFICATE----
MIIBszCCAVmgAwIBAgIUQ2n3...
...7wKqA0Z5Q==
Fixed
-----BEGIN CERTIFICATE-----
MIIBszCCAVmgAwIBAgIUQ2n3...
...7wKqA0Z5Q==
-----END CERTIFICATE-----

Convert PEM to PFX with openssl

The same conversion as an openssl command. Run them where the files are, on your own computer.

PEM to PFX
openssl pkcs12 -export -out cert.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem
PEM to PFX with 3DES, as PFX type Legacy
openssl pkcs12 -export -certpbe PBE-SHA1-3DES -keypbe PBE-SHA1-3DES -macalg sha1 -out cert.pfx -inkey privkey.pem -in cert.pem -certfile chain.pem

OpenSSL 3 makes a PFX with AES-256. The second command makes it with 3DES and a SHA-1 check, as the Legacy type on this page does. Use it for Windows Server 2016 and older. Microsoft's guide for Azure App Service gives the same options.

PEM, PFX and other certificate formats

FormatExtensionsWhat is insideUsed by
PEM.pem .crt .cer .keyBase64 text between BEGIN and END lines. Certificates, chain and key, in one file or several.nginx, Apache, HAProxy, Node.js, Linux, Let's Encrypt
DER.der .cer .crtOne certificate in binary. The same data as PEM, without the Base64.Java, Windows, Android, some routers
P7B.p7b .p7cPKCS #7: a list of certificates, often the whole chain. Never a private key.Windows, Tomcat, Java keytool, many CAs
PFX.pfx .p12PKCS #12: certificates and the private key in one binary file, locked with a password.IIS, Windows, Azure, Exchange, macOS Keychain

Java keystores (JKS)

This tool does not read or write a Java keystore (JKS). Java 9 and newer use PKCS #12 as the default keystore, so a PFX file from this page works in Java as it is. To move between JKS and PFX, use keytool, which comes with Java:

JKS to PFX, and PFX to JKS
keytool -importkeystore -srckeystore keystore.jks -destkeystore keystore.p12 -deststoretype PKCS12
keytool -importkeystore -srckeystore keystore.p12 -srcstoretype PKCS12 -destkeystore keystore.jks -deststoretype JKS

Other certificate resources

PEM to PFX FAQ

How do I convert PEM to PFX?

Paste the certificate and the CA chain in the editor, and the private key below them or in the Private key tab. Type a password in the Password field. Press Download to save the .pfx file. The tool checks that the key belongs to the certificate first.

How do I convert a CRT and KEY file to PFX?

Drop the .crt, .key and .ca-bundle files on the editor together, or one after the other. Each file adds to the text. The .key file goes to the Private key tab by itself. With openssl, run openssl pkcs12 -export -out cert.pfx -inkey private.key -in cert.crt -certfile ca-bundle.crt.

Which PFX type should I pick: Modern or Legacy?

Modern uses AES-256, as OpenSSL 3 makes it. Windows 11, Windows Server 2019 and newer, and OpenSSL 3 read it. Legacy uses 3DES and SHA-1. Pick Legacy for Windows Server 2016 and older, and for Azure App Service, where Microsoft's guide uses 3DES. macOS 14 and older also need Legacy to import into the Keychain. Modern is the default. Pick Legacy only when one of these systems must open the file.

Can I make a PFX without a password?

Yes: leave the Password field empty. The PFX then has an empty password, which Windows and openssl accept. The tool shows a warning, because anyone with the file can then read the private key. Use a password for a file you store or send.

How do I upload the PFX to Azure Key Vault or a Kubernetes secret?

The PFX view shows the file as Base64, which both take as text. Copy it, or download the binary .pfx file and import that. For Azure App Service, set PFX type to Legacy and upload the .pfx file with the same password.

Why does it say No private key?

A PFX for IIS or Azure needs the private key, and the editor has certificates only. Paste the key you made with your CSR in the Private key tab. To make a PFX with certificates only, such as for a trust store, use the SSL Converter.

Is it safe to make a PFX online?

Yes. The tool converts in your browser, in JavaScript on this page. Your files, your private key and the password are never uploaded, stored or logged, and nothing goes in the URL. The password is not saved, not even in your browser. You can check this yourself. Open the developer tools (F12), go to the Network tab and convert a file: no request goes out. Or load the page, turn off Wi-Fi and convert a PFX. For a key that guards a large site, the safest place is still your own computer: the openssl commands are on this page.