CRT to PEM
Drop a CRT, CER or DER certificate, binary or text, and get it as PEM. Or turn PEM into DER. Nothing leaves your browser.
Also: All formats, PFX to PEM, PEM to PFX, P7B to PEM
- 0
- Certificates
- 0
- Keys
- 0
- Errors
On this page
Quick answer
Drop the .crt file above. A binary file turns into PEM at once, and Download saves it. A .crt that starts with -----BEGIN is PEM already. The command is for a binary file.
openssl x509 -inform DER -in cert.crt -out cert.pemAbout CRT to PEM
Updated
What does a CRT to PEM converter do?
A .crt, .cer or .der file holds one certificate. It can be PEM text or binary DER, and the name does not tell you which. nginx, Apache and most Linux software want PEM. This page reads either form and gives you PEM. It also goes the other way: PEM to DER for Java, Windows and some routers.
How to use this tool
- Drop the .crt, .cer or .der file, binary or text. Or paste the certificate. A chain works too: paste every certificate.
- This page has no Private key tab. To join a certificate and its key in a PFX, use PEM to PFX.
- 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. Clear empties the editor.
- 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.
- Copy the text, or press Download to save the file. A PFX or DER file downloads as a real binary file, ready to import.
To see the fields of the certificate, such as the names, dates and fingerprints, use the Certificate Decoder.
The same tool, set up for other jobs: SSL Converter (all formats), PFX to PEM, PEM to PFX, P7B to PEM.
CRT, DER and PEM formats
| Format | Extensions | What is inside | Used by |
|---|---|---|---|
| PEM | .pem .crt .cer .key | Base64 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 .crt | One certificate in binary. The same data as PEM, without the Base64. | Java, Windows, Android, some routers |
| P7B | .p7b .p7c | PKCS #7: a list of certificates, often the whole chain. Never a private key. | Windows, Tomcat, Java keytool, many CAs |
| PFX | .pfx .p12 | PKCS #12: certificates and the private key in one binary file, locked with a password. | IIS, Windows, Azure, Exchange, macOS Keychain |
Common CRT to PEM errors
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.
----BEGIN CERTIFICATE----
MIIBszCCAVmgAwIBAgIUQ2n3...
...7wKqA0Z5Q==-----BEGIN CERTIFICATE-----
MIIBszCCAVmgAwIBAgIUQ2n3...
...7wKqA0Z5Q==
-----END CERTIFICATE-----The chain is in the wrong order
A server must send its own certificate first, then each issuer up to the root. A file with the root first works on some servers and fails on some clients. The tool puts the certificates in server order and says so in Notes. To check a chain in more detail, use the Certificate Decoder.
Convert CRT to PEM with openssl
The same conversion as an openssl command. Run them where the files are, on your own computer.
openssl x509 -inform DER -in cert.crt -out cert.pem
openssl x509 -in cert.pem -outform DER -out cert.derOther certificate resources
- RFC 7292: PKCS #12The PFX format: safe bags, the key bag, password-based encryption and the MAC.
- RFC 9579: PBMAC1 in PKCS #12The newer MAC for PFX files, based on PBKDF2. OpenSSL 3.4 can make it, and this tool reads it.
- RFC 2315: PKCS #7The SignedData structure that a P7B file uses to carry a list of certificates.
- RFC 7468: Textual Encodings (PEM)The BEGIN and END lines and the labels: CERTIFICATE, PRIVATE KEY, PKCS7.
- openssl pkcs12 manualThe command that makes and opens PFX files, with -legacy, -nodes, -noenc and -certpbe.
- openssl pkcs7 manualThe command that prints the certificates in a P7B file with -print_certs.
- Can't import an AES256-SHA256 PFX (Microsoft)Which Windows versions cannot import a PFX made with AES-256, and that 3DES works there.
- KB5025823: .NET and PFX rounds (Microsoft)Why .NET refuses a PFX with more than 600,000 password rounds.
- Import-PfxCertificate (Microsoft)How Windows imports a PFX into a certificate store from PowerShell.
- node-forgeThe JavaScript library this tool uses to open and seal PFX files and encrypted keys.
CRT to PEM FAQ
Is a CRT file in PEM format?
Often, yes. .crt is a name for a certificate file, and the content can be PEM text or binary DER. Open the file in a text editor. If it starts with -----BEGIN CERTIFICATE-----, it is PEM already: rename it to .pem. If you see random characters, it is DER. Drop it here to get PEM.
How do I convert CRT to PEM?
Drop the .crt file on the editor. A binary file turns into PEM at once; a text file is PEM already. The Certificate view shows the result, and Download saves cert.pem. With openssl, run openssl x509 -inform DER -in cert..
How can I convert a certificate to PEM format in Windows?
Use this page in any browser: drop the .cer file and download the PEM. In Windows itself, open the .cer file, go to Details, press Copy to File and pick Base-64 encoded X.509. That file is PEM.
What is a .pem file?
A PEM file is text: Base64 between a BEGIN line and an END line. The label on the lines says what is inside: CERTIFICATE, PRIVATE KEY or CERTIFICATE REQUEST. One file can hold several blocks, such as a certificate and its chain.
Is a .pem file a private key?
Only if it says PRIVATE KEY on the BEGIN line. A certificate is public: every server sends it to each visitor. A private key is secret. Many servers keep both in .pem files, so read the BEGIN line to know which one you have.
How do I convert PEM to DER or CER?
Paste the PEM and set To to DER. Download saves a binary .der file. Rename it to .cer if a program asks for that name: the content is the same. DER holds one certificate, so the tool converts the first one.
Is it safe to convert a certificate here?
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.