"SSL handshake failed": what it means and how to fix it
Before any data is sent, the client and the server have to agree on a TLS version, a cipher and a certificate. A handshake failure means they could not. The error rarely says which part broke, but a few checks narrow it down quickly.
What the SSL/TLS handshake is
"SSL" is the old name; every HTTPS connection today uses its successor, TLS. The handshake is the first exchange on a new connection, and in a few messages it settles everything the encrypted session needs:
- ClientHello. The client lists the TLS versions, cipher suites and key-exchange groups it supports, and names the site it wants (Server Name Indication, SNI).
- ServerHello. The server picks one version, one cipher suite and one key-exchange group from that list.
- Certificate. The server sends its certificate and the intermediate certificates that link it to a trusted root, and proves it holds the matching private key.
- Keys and Finished. Both sides derive the same session keys and confirm that nobody tampered with the exchange. Encrypted application data can now flow.
TLS 1.3 does all of this in one round trip; TLS 1.2 needs two. If either side cannot accept what the other offers, it sends a TLS alert and closes the connection. That is the handshake failure.
How the error appears
| Where | Typical message |
|---|---|
| Chrome, Edge | ERR_SSL_VERSION_OR_CIPHER_MISMATCH or ERR_SSL_PROTOCOL_ERROR |
| Firefox | SSL_ERROR_NO_CYPHER_OVERLAP or a "Secure Connection Failed" page |
| curl | curl: (35) ... handshake failure |
| openssl s_client | sslv3 alert handshake failure ... SSL alert number 40 |
| Python | ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] |
| Java | javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure |
| Cloudflare | Error 525: SSL handshake failed (between Cloudflare and your origin server) |
The "sslv3" in OpenSSL's message is a historical label for the alert, not a sign that SSL 3.0 is in use.
Common causes
- No TLS version in common. Browsers dropped TLS 1.0 and 1.1 in 2020, and many servers now accept only TLS 1.2 and 1.3. An old server that tops out at TLS 1.1 fails in every current browser; an old client (legacy Java, embedded devices, old Windows) that tops out at TLS 1.1 fails against a modern server.
- No cipher suite in common. The server allows only ciphers the client does not offer, or the reverse. This is common after hardening a server config, or with clients that only know older ciphers.
- Missing or wrong SNI. A server that hosts many sites uses SNI to pick the certificate. A client that does not send SNI, or sends the wrong name, can get the wrong certificate or an immediate alert.
- A certificate problem. An expired certificate, a name that does not match the hostname, or a missing intermediate stops the handshake. Most tools give these their own error (expired, name mismatch, unable to get local issuer certificate), but some report them only as a handshake failure.
- A wrong clock on the client. If the device's date is off by months, valid certificates look expired or not yet valid.
- The server wants a client certificate. With mutual TLS, a client that presents no certificate, or the wrong one, is refused during the handshake.
- Something in the middle. A firewall, proxy, antivirus or VPN that inspects TLS can break the handshake, for example by rejecting newer TLS features it does not understand.
- Not TLS on that port. Connecting with HTTPS to a port that serves plain HTTP, or to the wrong service, fails at the first message.
Find the cause
Start with the certificate, because it is the quickest thing to rule out. The SSL checker connects from outside your network and reports the certificate's validity, hostname match, chain completeness and revocation status. If the certificate is fine, look at the protocol: the post-quantum TLS checker tells you whether the server speaks TLS 1.3 at all.
From a terminal, test one TLS version at a time and always send SNI:
openssl s_client -connect example.com:443 -servername example.com -tls1_3 </dev/null
openssl s_client -connect example.com:443 -servername example.com -tls1_2 </dev/nullcurl -v https://example.com/ 2>&1 | grep -E 'TLS|SSL|alert'- Fails from your network but works from the SSL checker or a phone on mobile data: the cause is local (clock, proxy, firewall or an old client).
- Fails everywhere: the cause is the server's TLS configuration or certificate.
- Fails only in one app or language runtime: that runtime is too old or has its own TLS settings.
Fix it on the server
Enable TLS 1.2 and TLS 1.3, keep a modern cipher list, and serve a valid certificate with its full chain for every hostname the server answers. On Nginx:
ssl_protocols TLSv1.2 TLSv1.3;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;On Apache, SSLProtocol -all +TLSv1.2 +TLSv1.3 does the same. If you serve several sites from one IP address, give each its own server block with the right certificate, and set a sensible default so clients without SNI still get a certificate. Reload the service and test again with openssl s_client. If the server is behind a load balancer or CDN, the TLS settings that matter are the ones on that device.
Fix it on the client
- Set the correct date, time and time zone, ideally from network time.
- Update the browser, operating system or runtime. Old Java, Python and OpenSSL builds may not support TLS 1.2 or 1.3, or the ciphers a modern server requires.
- Make sure the client sends SNI. Most modern libraries do this automatically when you connect by hostname; connecting by IP address does not send it.
- Test without the proxy, VPN or antivirus HTTPS scanning. If that fixes it, update or reconfigure that product, or ask IT to exempt the site.
- Provide the client certificate if the server uses mutual TLS.
Cloudflare error 525: SSL handshake failed
Error 525 means the handshake failed between Cloudflare and your origin server, not between the visitor and Cloudflare. It appears when the SSL/TLS mode is Full or Full (strict), so Cloudflare connects to the origin over HTTPS. Check these on the origin:
- Port 443 is open and allows Cloudflare's IP ranges through the firewall.
- A certificate is installed for the hostname. A Cloudflare Origin CA certificate works and is free.
- The server answers SNI for that hostname.
- The server supports at least one cipher suite and TLS version Cloudflare offers; TLS 1.2 with modern ciphers is enough.
Do not fix 525 by switching to Flexible mode. It makes the error go away by sending traffic between Cloudflare and your server unencrypted. Error 526 is the related case where the handshake completes but Cloudflare cannot validate the origin's certificate in Full (strict) mode.
Why you should not bypass the error
Re-enabling TLS 1.0, allowing weak ciphers, or turning off certificate checks in a client (curl -k, verify=False) may get a connection through, but each one removes protection the handshake exists to provide. Fix the version, cipher or certificate that is actually wrong, and keep any bypass to a single manual test.
Frequently asked questions
How do I fix a handshake failure?
Check the certificate with an SSL checker, then test TLS 1.2 and 1.3 separately with openssl s_client. On the server, enable TLS 1.2 and 1.3 and install a valid certificate with its full chain. On the client, fix the clock, update the software and test without proxies.
What is the SSL handshake process?
The client offers its TLS versions, ciphers and key-exchange groups and names the site it wants. The server picks one of each and sends its certificate. Both sides derive shared session keys and confirm the exchange, and then encrypted data flows.
How do I fix error code 525?
Error 525 is Cloudflare failing to complete a TLS handshake with your origin. Make sure port 443 is open to Cloudflare, a certificate for the hostname is installed (a free Origin CA certificate works), SNI is answered and TLS 1.2 is enabled. Do not switch to Flexible mode.
Is an SSL handshake failure caused by my device or by the website?
If the site fails on every device and network, the cause is the server. If it works on a phone over mobile data but not on your computer or office network, look at your clock, browser version, proxy, VPN or antivirus.
What causes an SSL certificate error?
An expired certificate, a certificate issued for a different hostname, a missing intermediate certificate, a revoked certificate, or a device clock set to the wrong date. The SSL checker shows which of these applies to a given host.
Is it safe to bypass an SSL error?
Not as a fix. Ignoring certificate errors or enabling old TLS versions lets an attacker on the network read or change the traffic. A one-time manual test is fine, but the real fix is the server's configuration or the client's software and clock.