How to Convert CRT to PEM Using OpenSSL

Convert CRT to PEM

Working with SSL certificates often means dealing with different file formats, and sometimes you need them in PEM format. Whether you have CRT, CER, or DER files, figuring out how to handle these conversions might seem overwhelming at first. But don’t worry,we’ve got you covered!

In this guide, you’ll discover how to use OpenSSL to seamlessly convert your SSL certificates to PEM, step by step, whether you’re on Linux or Windows. Let’s simplify the process together!


Table of Contents

  1. Converting CRT to PEM Using OpenSSL (Linux and Windows)
  2. How to Convert DER or CER to PEM
  3. How to Install OpenSSL

Get SSL certificates today

Converting CRT to PEM Using OpenSSL (Linux and Windows)

Follow these simple steps to convert a CRT file to a PEM file using OpenSSL. The instructions work for both Linux and Windows, with minor differences in navigating to directories and running commands.

Step 1: Open the Command Line Tool

  • On Linux: Open the Terminal by pressing Ctrl + Alt + T or searching for “Terminal” in your applications.
  • On Windows: Open Command Prompt or PowerShell by pressing Win + R, typing cmd or powershell, and pressing Enter.

Step 2: Check if OpenSSL is Installed

OpenSSL is the main tool used for the conversion, whether you’re handling certificates or managing your private key securely. Make sure it’s installed on your system by running the following command:

openssl version

If OpenSSL is installed, you’ll see the version number displayed (e.g., OpenSSL 1.1.1).

If it’s not installed, you’ll get an error message like ‘openssl’ is not recognized as an internal or external command. Don’t worry! You can follow our detailed instructions on how to install it.


Step 3: Navigate to the Directory

Use the cd command to go to the folder where your CRT file is located.

On Linux:

cd /path/to/certificate/folder

On Windows:

cd C:\path\to\certificate\folder

Replace /path/to/certificate/folder or C:\path\to\certificate\folder with the actual path.


Step 4: Run the OpenSSL Command

Execute the following command to convert the CRT file to PEM format:

openssl x509 -in certificate.crt -outform PEM -out certificate.pem

Replace certificate.crt with the name of your CRT file.

The resulting file, certificate.pem, will be saved in the same directory, ready for use alongside your private key in SSL configurations.

Save 10% on SSL Certificates

Step 5: Verify the Output

Locate the certificate.pem file in your directory.

Open the file with a text editor to ensure it starts with:

-----BEGIN CERTIFICATE-----

which is the typical header for PEM certificates.


How to Convert DER or CER to PEM

If you have a DER-encoded or CER certificate in DER format and need to convert it to PEM format, OpenSSL can handle both formats with a similar command. Simply run the appropriate command to convert certificate files depending on your file type:

For DER to PEM

openssl x509 -inform DER -in certificate.der -outform PEM -out certificate.pem

For CER to PEM

openssl x509 -inform DER -in certificate.cer -outform PEM -out certificate.pem

Replace certificate.der or certificate.cer with the name of your file in DER format.

The resulting certificate.pem file will be saved in the same directory.


Check our extensive guide on SSL formats for an even better understanding of how they work.

How to Install OpenSSL

If OpenSSL is not already installed on your system, follow these steps to set it up:

On Linux

Use a package manager to install it:

Ubuntu/Debian:

sudo apt update
sudo apt install openssl

CentOS/Red Hat:

sudo yum install openssl

On Windows

  1. Download the OpenSSL installer from a trusted source like Shining Light Productions.
  2. Follow the installation instructions, ensuring you add OpenSSL to your system’s PATH during setup.

Secure Your Website Like a Pro with SSL Dragon!

Converting CRT, DER, PFX format or CER files to PEM format is an essential skill for managing SSL certificates, and OpenSSL makes the process quick and easy.

If you’re looking for a one-stop shop for all your SSL certificate needs, SSL Dragon has you covered. We offer a wide range of SSL products, along with expert guidance to help you secure your website. Visit SSL Dragon today to explore our offerings and simplify your SSL certificate management!

Save 10% on SSL Certificates when ordering from SSL Dragon today!

Fast issuance, strong encryption, 99.99% browser trust, dedicated support, and 25-day money-back guarantee. Coupon code: SAVE10

A detailed image of a dragon in flight
Written by

Experienced content writer specializing in SSL Certificates. Transforming intricate cybersecurity topics into clear, engaging content. Contribute to improving digital security through impactful narratives.