Guides 7 min read Published February 13, 2025

How to Check SSL Certificate Expiry Date: Browser, OpenSSL, cURL & Automated Scripts

Step-by-step guide to inspect SSL/TLS certificate expiration dates using Chrome, OpenSSL CLI, cURL, Python, and automated web tools.

🛡️
CheckSSLExpiry Security Research Team SSL/TLS Security & Cryptographic Reliability

⚡ Check Your Domain's SSL Expiry Right Now

Instant certificate inspection and zero-login automated email alerts.

Method 1: Instant Online Inspection (Easiest)

The fastest way to inspect any public website's SSL certificate is to use our free tool:

  1. Go to CheckSSLExpiry.com.
  2. Enter your domain name (e.g. github.com or yourcompany.com).
  3. Click Check Certificate to instantly see exact days/hours remaining, issuer authority, SANs list, and SHA-256 fingerprints.

Method 2: Using OpenSSL in the Terminal (Linux / macOS / Windows WSL)

echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -noout -dates

Sample Output:

notBefore=Jan 15 00:00:00 2025 GMT
notAfter=Apr 15 23:59:59 2025 GMT

To check if the certificate will expire within the next 30 days (returns exit code 0 if valid, 1 if expiring/expired):

echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -checkend 2592000 -noout

Method 3: Using cURL CLI

curl -Iv https://example.com 2>&1 | grep -i "expire date"

Method 4: Python Script to Check SSL Expiration Programmatically

import ssl
import socket
import datetime

def get_ssl_expiry_days(hostname, port=443):
    context = ssl.create_default_context()
    with socket.create_connection((hostname, port), timeout=5) as sock:
        with context.wrap_socket(sock, server_hostname=hostname) as ssock:
            cert = ssock.getpeercert()
            expire_date_str = cert['notAfter']
            expire_date = datetime.datetime.strptime(expire_date_str, '%b %d %H:%M:%S %Y %Z')
            remaining = expire_date - datetime.datetime.utcnow()
            return remaining.days

print(f"Days remaining: {get_ssl_expiry_days('example.com')}")

⚡ Stop Checking Manually — Automate Alerts for Free

Set up automated warning emails before your SSL certificate expires.

Setup Free SSL Expiry Alerts →
Advertisement
Ad Space Reserved