Short answer: run this, with your own address in place of ours:
curl -sv -o /dev/null https://sitehealthradar.com/ 2>&1 | grep -E 'start date|expire date'
Real output, 6 November 2026:
* start date: Nov 1 04:18:22 2026 GMT
* expire date: Jan 30 04:18:21 2027 GMT
The expire date is the day browsers start showing a full-page warning. If the command prints nothing, the certificate may already be broken: read "If it has already expired" below before you trust a blank.
A blank can also come from curl itself. In curl's source code (read 23 November 2026), builds that use Schannel, Windows' own TLS library, don't print these two lines with -v, even for a good certificate. curl --version shows which library you have. We haven't run these commands on Windows.
The openssl version, if you prefer it. On a Mac this is the built-in /usr/bin/openssl (LibreSSL 3.3.6); Homebrew's OpenSSL 3.6.3 printed the same two lines. Run on 2026-11-09:
echo | openssl s_client -connect sitehealthradar.com:443 -servername sitehealthradar.com 2>/dev/null \
| openssl x509 -noout -dates
notBefore=Nov 1 04:18:22 2026 GMT
notAfter=Jan 30 04:18:21 2027 GMT
Is the certificate OK right now? (one line for scripts)
The dates alone don't tell you the certificate is valid for that name. curl's own check does. Ask it for its exit code:
curl -s -o /dev/null -w 'exitcode=%{exitcode} verify=%{ssl_verify_result}\n' https://sitehealthradar.com/
exitcode=0 verify=0
The same line against a test site whose certificate expired in 2015:
curl -s -o /dev/null -w 'exitcode=%{exitcode} verify=%{ssl_verify_result}\n' https://expired.badssl.com/
exitcode=60 verify=10
And against a test site whose certificate is for a different name:
exitcode=60 verify=1
Read the exit code, not the verify number. curl's docs say exit code 0 is success and 60 means "Peer certificate cannot be authenticated with known CA certificates". For the verify number they say only that 0 means the check passed. The other numbers come from your TLS library and differ between builds (on our Mac a wrong name gave 1, not a "wrong name" code). %{exitcode} needs curl 7.75.0 or later.
One limit: a pass on your own computer doesn't prove the server sends the full chain. A test site that sends only its own certificate, with no intermediate, still gave us this on a Mac:
exitcode=0 verify=0
Other clients may refuse that same site. -w '%{certs}' (below) shows how many certificates the server really sent. Ours sends more than one; that test site sends one. Only one, issued by a certificate authority's intermediate (the test site's was Let's Encrypt YR1), usually means the intermediate is missing. On Linux, curl refused the same site: error 60, unable to get local issuer certificate.
If it has already expired, you'll see no dates
This is where the usual recipe lets you down. Without any extra flag, curl stops at the certificate error and never prints the dates:
curl -sv -o /dev/null https://expired.badssl.com/ 2>&1 | grep -E 'expire date|certificate problem'
* SSL certificate problem: certificate has expired
To read the dates anyway, add -k:
curl -skv -o /dev/null https://expired.badssl.com/ 2>&1 | grep -E 'start date|expire date|verify'
* start date: Apr 9 00:00:00 2015 GMT
* expire date: Apr 12 23:59:59 2015 GMT
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
Use -k only to read dates, never to decide whether a certificate is fine. Two things in that run show why. The verify line blamed the issuer, not the expiry. And on wrong.host.badssl.com, whose certificate doesn't cover that name, curl -skv printed SSL certificate verify ok. while plain curl refused with no alternative certificate subject name matches target host name and exit code 60. We ran both on 6 November 2026 and again on 9 November, with the same result.
openssl's s_client behaves like -k here: its manual says it carries on with the handshake after certificate errors. So the openssl line above prints dates for an expired certificate too, and that output doesn't mean the certificate is valid. Against expired.badssl.com on 2026-11-09 both versions printed notAfter=Apr 12 23:59:59 2015 GMT with no error on screen.
Keep -servername in. Without it, the Mac's LibreSSL sends no site name, Cloudflare refuses the connection (SSL alert number 40, no peer certificate available), and you get unable to load certificate instead of dates. OpenSSL 3.6.3 sends the name by default and still worked. Both seen 2026-11-09.
How many days are left?
On macOS (tested 6 November 2026):
date -j -u -f "%b %d %T %Y" "Jan 30 04:18:21 2027" +%s
date -u +%s
1801282701
1793966590
(1801282701 − 1793966590) ÷ 86400 = 84.7, so 84 full days left at that moment.
On Linux (GNU date): date -u -d "Jan 30 04:18:21 2027" +%s prints the same 1801282701.
For scripts, openssl can answer "does it expire within N seconds?" directly. 2592000 seconds is 30 days. Read the exit code, not the text: on 2026-11-09 OpenSSL 3.6.3 printed Certificate will not expire and exited 0, but the Mac's LibreSSL 3.3.6 printed nothing and also exited 0. With 7776000 (90 days) both exited 1, and only OpenSSL printed Certificate will expire. So echo $? after the command: 0 means more than N seconds left. 1 means less, or that openssl got no certificate to read at all (the site was down, for example). Treat a 1 as "go and look", not as proof of expiry. We saw the second case with OpenSSL 3.6.3 in early November; for LibreSSL it comes from the source code, and we didn't run it.
echo | openssl s_client -connect sitehealthradar.com:443 -servername sitehealthradar.com 2>/dev/null \
| openssl x509 -noout -checkend 2592000
The x509 manual says -checkend exits nonzero if the certificate will expire in that time and zero if not, so a cron job can test $?, as long as its alert allows for both meanings of 1.
Why do I see four expiry dates?
curl 7.88.0 and later can print the whole chain with -w '%{certs}'. On our site:
curl -s -o /dev/null -w '%{certs}' https://sitehealthradar.com/ | grep -iE 'Subject:|Expire date'
Subject:CN = sitehealthradar.com
Expire date:Jan 30 04:18:21 2027 GMT
Subject:C = US, O = Let's Encrypt, CN = YE1
Expire date:Sep 2 23:59:59 2028 GMT
Subject:C = US, O = ISRG, CN = Root YE
Expire date:Sep 2 23:59:59 2032 GMT
Subject:C = US, O = Internet Security Research Group, CN = ISRG Root X2
Expire date:Sep 2 23:59:59 2032 GMT
The first one, with your own name as the Subject, is yours to renew. The others belong to the certificate authority. curl's docs say %{certs} works only with the OpenSSL, GnuTLS, Schannel and Rustls backends, so on some builds it prints nothing. Keep the -i in that grep: Schannel builds write Expire Date with a capital D, according to curl's source. curl --version shows which you have. On our Mac it printed (SecureTransport) LibreSSL/3.3.6. curl's docs say a backend shown in parentheses is available but isn't the default, so this Mac uses LibreSSL unless told otherwise.
Behind Cloudflare or another CDN
If your site sits behind a CDN, these commands, run against your domain, show the CDN's certificate, the one your visitors get. Our own site answers with server: cloudflare, and the certificate above, issued by YE1, is the one Cloudflare serves. Your origin server may have its own certificate with a different date (in Cloudflare's Full (strict) mode it has to be valid as well). We haven't printed a command to check the origin yet, because we haven't tested one on a server we own.
When should it be renewed?
Certificates are getting shorter. Let's Encrypt plans to cut its default from 90 days to 64 days in February 2027 and to 45 days in February 2028, so a date that looks far away soon won't be. Our NET::ERR_CERT_DATE_INVALID guide has the details and what to do when renewal fails.
Let something else watch the date
The free SSL certificate checker reads the certificate your address serves now. It flags one with 21 days or fewer left and says when it expires. Monitoring ($10 a site a month, with a free trial for one site: 30 days from approval, no card) checks it for you and warns you again as the time left drops to 30, 15, 7, 3 and 1 days. Both see one address from one place, so they can see a different certificate from the one your computer gets if your site has several servers or addresses.
Sources were read on 6 November 2026, and the passages we rely on were checked again on 23 November 2026: curl write-out options, curl exit codes, curl --version, OpenSSL s_client manual, OpenSSL x509 manual, badssl.com test hosts.