How to Find SSL/TLS Certificate Expiration Date for Multiple Websites

Published January 14, 2026

How to find expiration date of SSL / TLS certificates of multiple websites

In this blog post, we will find the expiration date of SSL / TLS certificates of multiple websites or domains.

Create a text file with multiple domain names

Create a text file urls.txt containing multiple domains, one per line. Your file can be like this:

urls.txt

yahoo.com
google.com
attrition.org
xkcd.com

Create a shell script to find the expiration dates

Create a file, a bash script, with these contents.

expiration_dates.sh

#!/bin/bash

#
# Bash script to check SSL certificate expiration dates for a list of URLs
# Created by Arul John https://aruljohn.com
#

while IFS= read -r url; do
    echo ">> Expiration date for $url"
    echo | openssl s_client -servername $url -connect $url:443 2>/dev/null | openssl x509 -noout -dates | grep notAfter | sed 's/notAfter=//'
    echo
done < "urls.txt"

Then, chmod it to 755.

chmod 755 expiration_dates.sh

Run the bash script

./expiration_dates.sh

Your output will be something like this:

$ ./expiration_dates.sh 
>> Expiration date for google.com
Feb 25 15:49:26 2026 GMT

>> Expiration date for yahoo.com
Apr  1 23:59:59 2026 GMT

>> Expiration date for bing.com
Jun 14 22:38:02 2026 GMT

>> Expiration date for yandex.com
Feb 23 20:59:59 2026 GMT

You can refine this to alert you if the SSL certificate has expired or is nearing expiration, within 30 days, or something similar.

Conclusion

If you have used this at work or for personal use, let me know in the comments or via email. Thanks for reading!

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Last Updated: January 14, 2026.     This post was originally written on January 14, 2026.