Home >Blog

How to Compare Two SSL Certificates

Published Updated

When you renew a certificate, migrate a domain, or audit an infrastructure, you often need to compare two SSL certificates to see what actually changed. The difference may be a single field, or it may be a completely different chain. This guide shows how to compare two SSL certificates side by side: decode them, check the fields that matter, and use OpenSSL to do the diff automatically.

Why compare SSL certificates

Certificates look similar at a glance, but the details matter. Comparing them answers practical questions:

  • Is the renewal actually the same certificate, or a new key and a new issuer?
  • Did the subject alternative names (SANs) change when the domain list was updated?
  • Is the replacement certificate still valid, and for how long?
  • Did the key strength or the signature algorithm improve?

You can answer all of these with two files and a few OpenSSL commands.

Decode both certificates

First, get both certificates into PEM files. If you have the files already, skip this step. To pull a live certificate from a server:

openssl s_client -connect example.com:443 -servername example.com \
  -showcerts < /dev/null 2> /dev/null | openssl x509 -outform PEM > cert-old.pem

Run the same command against the other server or the same host to get cert-new.pem. If a certificate arrives with extra chain certificates, keep only the leaf certificate for the comparison.

Compare the subject and issuer

The subject identifies who the certificate belongs to; the issuer identifies who signed it. Print both fields for each file:

openssl x509 -in cert-old.pem -noout -subject -issuer
openssl x509 -in cert-new.pem -noout -subject -issuer

Watch for these changes:

  • Subject — the common name (CN) or organization may change after a company rename or a move to a different domain structure.
  • Issuer — a switch between issuers means a different trust path, and possibly a different root that clients must trust.

Check the validity period

Validity determines whether a certificate is usable right now and how much time remains:

openssl x509 -in cert-old.pem -noout -dates
openssl x509 -in cert-new.pem -noout -dates

Common problems: the new certificate has not started yet (notBefore is in the future), or it expires sooner than the old one. Compare the notAfter dates to confirm the renewal actually extends coverage.

Compare key strength and signature algorithm

Key strength and the signature algorithm directly affect security. Older certificates commonly use RSA-2048 with SHA-256; newer ones may use ECDSA or RSA-3072/4096.

openssl x509 -in cert-old.pem -noout -text | grep -A1 "Public-Key"
openssl x509 -in cert-old.pem -noout -text | grep "Signature Algorithm"
openssl x509 -in cert-new.pem -noout -text | grep -A1 "Public-Key"
openssl x509 -in cert-new.pem -noout -text | grep "Signature Algorithm"

A downgrade in key length or an outdated signature algorithm (such as SHA-1) is a red flag even when every other field matches.

Compare subject alternative names

The SAN list decides which hostnames the certificate actually covers. This is the most common reason a certificate breaks a site after renewal:

openssl x509 -in cert-old.pem -noout -ext subjectAltName
openssl x509 -in cert-new.pem -noout -ext subjectAltName

Missing domains, extra domains, and wildcard changes all show up here. Compare the full list, not just the common name.

Compare fingerprints

A fingerprint is a short hash of the whole certificate. Two certificates with the same fingerprint are byte-for-byte identical:

openssl x509 -in cert-old.pem -noout -fingerprint -sha256
openssl x509 -in cert-new.pem -noout -fingerprint -sha256

If the fingerprints differ but the visible fields look the same, the difference is in a field you did not print — commonly the public key, serial number, or extensions. In that case the certificates are not identical even if the subject matches.

Automate the comparison

For a quick scripted diff, extract the fields into a file and compare them:

for f in cert-old cert-new; do
  openssl x509 -in $f.pem -noout \
    -subject -issuer -dates -fingerprint -sha256 \
    -ext subjectAltName > $f.summary.txt
done
diff cert-old.summary.txt cert-new.summary.txt || true

The output shows exactly which lines changed. Add the public key check when you need to confirm whether the private key changed:

openssl x509 -in cert-old.pem -noout -pubkey | openssl sha256
openssl x509 -in cert-new.pem -noout -pubkey | openssl sha256

Common questions

Why do two certificates with the same subject have different fingerprints? The fingerprint covers the entire certificate, including the public key, the serial number, and the validity dates. Any of those changes produces a different fingerprint.

Is a different issuer always a problem? Not necessarily. Many hosts move between intermediate certificates from the same root, or between roots that are equally trusted. Check whether clients trust the new chain before switching.

Can I compare certificates without OpenSSL? Yes, but OpenSSL is the most reliable tool on Linux and macOS. Online decoders and browser views are convenient for reading one certificate; a scripted diff is still the fastest way to compare two.

Next steps

Start by decoding both certificates and comparing subject, dates, and SANs. Add the fingerprint and public-key checks when you need proof that nothing else changed. For regular renewals, keep the summary output from the last certificate so the next comparison takes one command.

FAQ

Why do two certificates with the same subject have different fingerprints?
The fingerprint covers the entire certificate, including the public key, serial number, and validity dates. Any of those changes produces a different fingerprint.
Is a different issuer always a problem?
Not necessarily. Many hosts move between intermediate certificates from the same root, or between roots that are equally trusted. Check whether clients trust the new chain before switching.
Can I compare certificates without OpenSSL?
Yes, but OpenSSL is the most reliable tool on Linux and macOS. Online decoders are convenient for reading one certificate; a scripted diff is the fastest way to compare two.

Table of Contents

Information

  • Hits40
  • Published date2026/09/14

More Posts

Explore more articles from this section
How to Decode an SSL Certificate Online
Aug 24, 202698views

How to Decode an SSL Certificate Online

Learn how to decode an SSL certificate online by pasting PEM text or uploading a certificate, then review the ...

#ssl certificate#certificate decoder#PEM#TLS
X.509 Certificate Decoder: How to Read an X.509 Certificate
Sep 02, 202684views

X.509 Certificate Decoder: How to Read an X.509 Certificate

A practical guide to using SSL Certificate Decoder to inspect a public PEM certificate and understand its X.50...

#x509 certificate decoder#X.509 certificate#SSL certificate decoder#PEM
How to Decode a PEM Certificate Online with SSL Certificate Decoder
Aug 30, 202681views

How to Decode a PEM Certificate Online with SSL Certificate Decoder

Learn how PEM boundary markers work and how to decode a public PEM certificate by pasting it or uploading a PE...

#pem certificate decoder#PEM certificate#BEGIN CERTIFICATE#END CERTIFICATE
How to Read SSL Certificate Details: A Practical Guide to Subject, Issuer, CN, SAN, and Fingerprints
Aug 27, 202679views

How to Read SSL Certificate Details: A Practical Guide to Subject, Issuer, CN, SAN, and Fingerprints

Learn how to use SSL Certificate Decoder to inspect a public certificate and understand Subject, Issuer, Commo...

#SSL certificate#certificate details#Subject#Issuer
Fix "PEM Certificate Is Invalid" Error: Common Causes and Solutions
Sep 30, 202678views

Fix "PEM Certificate Is Invalid" Error: Common Causes and Solutions

Why PEM certificates fail to load, the five common causes, and the exact OpenSSL commands to fix each one.

#pem certificate invalid#openssl pem#fix pem error
When Parsing an SSL Certificate I Get 'PEM Certificate Is Invalid or Unrecognized' – What Does It Mean and How Do I Fix It?
Oct 11, 202670views

When Parsing an SSL Certificate I Get 'PEM Certificate Is Invalid or Unrecognized' – What Does It Mean and How Do I Fix It?

The parser could not find a valid PEM block. Nine times out of ten the file is fine and the copy is broken — m...

#pem certificate invalid#ssl certificate parse error#openssl x509#der vs pem
Feedback email