How to Check When Your SSL Certificate Expires
- ssl
- tls
- certificates
Every SSL certificate (more precisely, a TLS certificate) has a fixed expiry date. After that moment, browsers refuse to trust it and show visitors a full-page warning such as "Your connection is not private". Most people close the tab, and API clients and webhooks simply fail.
The fix is easy if you see it coming. This guide shows four ways to check when a certificate expires, explains why expiry is becoming more frequent, and covers how to make sure you are never surprised.
Why certificates expire
Certificates expire on purpose. A limited lifetime means that if a private key is stolen or a certificate is issued by mistake, the damage has an end date. It also forces sites to adopt newer standards regularly.
Lifetimes have been shrinking for years. In 2025 the CA/Browser Forum, the group of certificate authorities and browser makers that sets the rules for public certificates, approved a schedule that steps the maximum lifetime down further: to 200 days from March 2026, 100 days from March 2027 and 47 days from March 2029. Many sites already use 90-day certificates from free authorities such as Let's Encrypt.
Shorter lifetimes mean more renewals, and more renewals mean more chances for one to fail quietly. That makes checking expiry dates, and automating that check, more important every year.
Method 1: Check in your browser
The quickest way for a single site:
- Open the site in your browser.
- Click the icon to the left of the address (a padlock or a "site information" icon, depending on the browser).
- Choose the option to view the connection or certificate details. The wording varies by browser and version, but it is usually something like "Connection is secure", then "Certificate is valid".
- Look for Valid to, Expires on or Not after.
This works, but it is manual and only shows the certificate your browser received from the server it reached. If your site sits behind a load balancer or CDN, different servers may present different certificates.
Method 2: Use OpenSSL on the command line
On macOS and most Linux systems, OpenSSL is already installed. This command connects to a site, fetches its certificate and prints the validity dates:
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
| openssl x509 -noout -dates
The output looks like this:
notBefore=Sep 1 00:00:00 2026 GMT
notAfter=Nov 30 23:59:59 2026 GMT
notAfter is the expiry date. A few notes:
-servernamematters. It sends the host name during the handshake (SNI). Servers that host several sites use it to choose the certificate. Without it, you may see a default certificate for a different site.- To see the issuer and the names covered, add more fields:
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
| openssl x509 -noout -issuer -subject -ext subjectAltName -enddate
- To test whether it expires soon, use
-checkendwith a number of seconds. This example exits with an error if the certificate expires within 14 days (1,209,600 seconds), which makes it handy in scripts:
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null \
| openssl x509 -noout -checkend 1209600 \
&& echo "OK for at least 14 days" || echo "Expires within 14 days"
If you have a certificate file on disk rather than a live site, skip s_client:
openssl x509 -in /path/to/certificate.pem -noout -enddate
Method 3: Check with curl
curl prints certificate details in verbose mode. The exact wording depends on the TLS library it was built with, but you will usually see a line that starts with "expire date":
curl -vI https://example.com 2>&1 | grep -i "expire date"
This is quick, but OpenSSL's output is more consistent across systems and easier to use in scripts.
Method 4: Ask your certificate tool
If you use Certbot (a common Let's Encrypt client) on your own server, it can list every certificate it manages along with its expiry date:
sudo certbot certificates
You can also check that automatic renewal will work, without actually renewing, using a dry run:
sudo certbot renew --dry-run
Hosting control panels and managed platforms usually show certificate status in their dashboards too. Check where your provider shows it and whether it sends its own expiry emails.
What else can go wrong besides expiry
A certificate can be inside its validity dates and still break your site:
- Wrong host name. A certificate for
example.comdoes not coverwww.example.comunless that name is also listed. A wildcard like*.example.comcoverswww.example.comandshop.example.com, but notexample.comitself and nota.b.example.com. - Missing intermediate certificate. Servers should send the intermediate certificates that link your certificate to a trusted root. Some browsers can fill in a missing one, but many API clients and command-line tools can't, so the site works in one place and fails in another.
- Self-signed or private certificates. These are fine for internal tools but not trusted by public browsers.
- A forgotten domain. Old marketing domains, API subdomains and redirect-only domains often get left out of renewal setups.
The OpenSSL command from Method 2 reports verification problems in its full output. Remove the 2>/dev/null and look at the Verify return code line near the end; 0 (ok) means the chain verified.
How to make sure a certificate never expires unnoticed
Checking by hand works for one site, once. To stay safe over time:
- Automate renewal. Use ACME clients such as Certbot, or your host's or CDN's managed certificates, so renewal needs no one to remember it.
- Monitor the result, not just the job. Renewal jobs fail silently: a changed DNS record breaks validation, a server move loses a cron job, or a payment method on a paid certificate expires. An outside check of the certificate that visitors actually receive catches all of these.
- Get reminders at several points. One warning is easy to miss. Reminders at 30, 14, 7 and 1 days give you time to investigate and fix without rushing.
- Cover every host name. Include
wwwand the bare domain, API and app subdomains, and domains that only redirect, since a redirect overhttps://needs a valid certificate too.
Aobex does this for every https:// monitor: it reads the live certificate once a day, records the expiry date and issuer, sends reminders at 30, 14, 7 and 1 days, and alerts you right away if a certificate becomes invalid. The reminders reset automatically when a renewed certificate appears.
Quick reference
| Task | Command |
|---|---|
| Expiry dates of a live site | echo | openssl s_client -connect HOST:443 -servername HOST 2>/dev/null | openssl x509 -noout -dates |
| Fails if expiring within 14 days | ... | openssl x509 -noout -checkend 1209600 |
| Expiry of a file on disk | openssl x509 -in cert.pem -noout -enddate |
| Certbot-managed certificates | sudo certbot certificates |
| Test Certbot renewal | sudo certbot renew --dry-run |
Expiry is one of the few outages you can see coming weeks ahead. A few minutes of setup turns it into a calendar reminder instead of an emergency. And if a site does go down for another reason, our checklist on what to do when your website goes down can help.