CSR decoder

Paste a certificate signing request or a certificate and see what's inside it. The names, the key type and size, the signature algorithm, the dates, and anything that looks wrong. It's decoded in your browser, so nothing is uploaded.

Reads PEM text and binary DER files: .csr, .pem, .crt, .cer, .der. It's decoded in your browser and nothing is uploaded. A CSR and a certificate hold public information only. Never paste a private key anywhere.

How to decode a CSR

  1. Paste the request into the box. It starts with -----BEGIN CERTIFICATE REQUEST-----.
  2. Read the result underneath: who the request is for, which key it carries, and any warnings.

You can also drop a file on the box or click "Choose a file". Text files (PEM) and binary files (DER) both work.

The same box decodes a certificate. Paste one that starts with -----BEGIN CERTIFICATE----- and you also get the issuer, the validity dates, the serial number and what the certificate is allowed to do.

Check a CSR before you send it to a certificate authority. A mistake in the request ends up in the certificate, and fixing it means a reissue.

What a CSR is

A certificate signing request is the file you give a certificate authority when you ask for a certificate. The standard that defines it, RFC 2986, says a request "consists of a distinguished name, a public key, and optionally a set of attributes", signed by whoever is asking.

In plain terms it holds:

  • Who you are. The subject: a name, and usually an organization and country
  • Your public key. The half of the key pair that's safe to share
  • A signature made with your private key, which proves you hold the other half

The private key isn't in the CSR and never leaves your machine. The certificate authority checks your details, then issues a certificate that binds the same public key to your name.

What the fields mean

Field What it is Example
Common name (CN) The main name. A domain for a website, a company name for code signing example.com
Organization (O) The legal name of the company Example Software Inc
Organizational unit (OU) A department. Rarely used now Engineering
Locality (L) City San Francisco
State or province (ST) Written out in full California
Country (C) Two-letter code US
Subject alternative names Every name the certificate should cover example.com, www.example.com
Public key The algorithm and size RSA, 2048 bits
Signature algorithm How the request was signed SHA-256 with RSA

For a certificate you'll also see:

Field What it is
Issuer The certificate authority that signed it
Valid from, valid until The dates between which it's accepted
Serial number The issuer's unique number for this certificate
Key usage What the key may do, such as "Digital signature"
Extended key usage What the certificate is for: "Server authentication (TLS)", "Code signing" and so on
Certificate authority Whether it can issue other certificates
Fingerprint A SHA-256 hash of the whole certificate, used to identify it exactly

Things to check before you submit a CSR

The names. A typo in the common name or the organization is the most common mistake. The certificate authority will match the organization against official records, so it has to be the registered legal name.

Subject alternative names. For a website, the alternative names are what counts. The HTTP standard says clients must not use the common name to check a server's identity, and the rules certificate authorities follow mark the common name as "not recommended". Many authorities add the alternative names from your order form, but if you put them in the CSR yourself, check that every hostname is there, including www.

Key size. The industry's Baseline Requirements say an RSA key must be at least 2048 bits for a website certificate. For a code signing certificate the requirement is at least 3072 bits. The decoder warns you about a key under 2048.

Signature algorithm. It should be SHA-256 or better. SHA-1 is no longer accepted.

That it matches your private key. A CSR is no use if you've lost the key it was made from. The commands below show how to compare them.

How to generate a CSR

With OpenSSL, one command makes a new 2048-bit key and a request for it:

openssl req -new -newkey rsa:2048 -nodes \
  -keyout example.key -out example.csr \
  -subj "/C=US/ST=California/L=San Francisco/O=Example Software Inc/CN=example.com" \
  -addext "subjectAltName=DNS:example.com,DNS:www.example.com"

example.key is the private key. Keep it secret and back it up. example.csr is what you send.

For an elliptic curve key, which is smaller and just as strong:

openssl ecparam -name prime256v1 -genkey -noout -out example.key
openssl req -new -key example.key -out example.csr -subj "/CN=example.com"

On Windows, certreq -new request.inf request.csr does the same from a settings file, and IIS has a "Create Certificate Request" wizard.

Decode a CSR or certificate from the command line

To read a request:

openssl req -in example.csr -noout -text

To read a certificate:

openssl x509 -in example.crt -noout -text

To check that a certificate, a request and a private key belong together, compare their public keys. All three commands should print the same hash:

openssl x509 -in example.crt -noout -pubkey | openssl sha256
openssl req  -in example.csr -noout -pubkey | openssl sha256
openssl pkey -in example.key -pubout        | openssl sha256

For a binary file, add -inform der.

PEM and DER

They're two ways of writing the same data.

  • DER is the raw binary encoding
  • PEM is that binary written as base64 text between -----BEGIN ...----- and -----END ...----- lines, so it survives being pasted into an email or a form

File extensions don't tell you which one you have. A .crt or .cer can be either. Open it in a text editor: if you see -----BEGIN, it's PEM. To convert:

openssl x509 -in cert.der -inform der -out cert.pem
openssl x509 -in cert.pem -outform der -out cert.der

CSRs for code signing certificates

If you're buying a certificate to sign software, the request works a little differently.

  • The common name is your publisher name, the one Windows shows to people installing your app. It's a company or personal name, and there are no hostnames
  • The key has to be at least 3072-bit RSA, as above
  • The key usually has to live on hardware. Since June 1, 2023, code signing keys must be kept on certified hardware: a USB token or a cloud signing service. So the CSR is typically generated on that device, and you may never handle a .key file at all. The page on EV code signing certificates explains the options

Once the certificate is issued, paste it here to confirm it says "Code signing" under extended key usage. Then SignTool applies it to your installer, or Azure Trusted Signing does the same without a certificate file of your own.

To check a file after signing, the checksum calculator gives you its SHA-256.

Common questions about CSRs

What is a CSR?

A certificate signing request: a small file containing your public key and your details, signed with your private key. You send it to a certificate authority, which returns a certificate.

Is it safe to paste a CSR into an online decoder?

A CSR contains only public information, so there's nothing secret to leak. On this page it's also decoded by JavaScript in your browser and isn't sent to a server. A private key is another matter: never paste one into any website.

Can I get the private key from a CSR?

No. The CSR holds the public key only. If you've lost the private key, generate a new key and a new CSR.

How do I decode a certificate?

Paste it into the same box. Anything starting with -----BEGIN CERTIFICATE----- is read as a certificate, and you'll see the issuer, validity dates and permitted uses as well.

What's the difference between a CSR and a certificate?

A CSR is the request, signed by you. A certificate is the answer, signed by a certificate authority, with an issuer, a serial number and an expiry date added.

Why does my CSR have no subject alternative names?

Because it was generated without them, which is the default with most tools. Add them with -addext "subjectAltName=..." in OpenSSL, or enter the hostnames in the certificate authority's order form, which many accept.

What key size should I use?

RSA 2048 bits is the minimum for a website certificate, and RSA 3072 for code signing. An elliptic curve P-256 key is a good modern choice where it's supported.

How do I check that a CSR matches a private key?

Print the public key from each and compare. openssl req -in example.csr -noout -pubkey | openssl sha256 and openssl pkey -in example.key -pubout | openssl sha256 should give the same hash.

Does this decoder verify the certificate?

No. It reads what the file says. It doesn't check the signature, the chain up to a trusted root, or whether the certificate has been revoked. Use it to inspect contents, not to decide whether to trust something.

What file types can I decode?

PEM and DER files: .csr, .req, .pem, .crt, .cer and .der. Password-protected .pfx and .p12 bundles aren't supported, because they contain a private key.