When an HTTPS connection fails, most tools just say "connection failed." They can't show you why. The encryption is a black box.
openssl s_client opens that box. It establishes an SSL/TLS connection to any server, performs the handshake, shows you every certificate in the chain, tells you what cipher was negotiated—and then hands you the keyboard. You're not observing a connection. You're making one. You become the client, speaking directly to the server, seeing exactly what it sends back.
Basic Usage
Connect to an HTTPS server:
openssl s_client -connect example.com:443
This establishes an SSL/TLS connection to port 443 and displays everything about the negotiation: certificate chain, TLS version, cipher suite, verification status.
What the Output Tells You
A successful connection shows:
CONNECTED(00000003)
depth=2 C = US, O = DigiCert Inc, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, CN = DigiCert TLS RSA SHA256 2020 CA1
verify return:1
depth=0 C = US, ST = California, L = Los Angeles, O = Example, CN = example.com
verify return:1
---
Certificate chain
0 s:C = US, ST = California, L = Los Angeles, O = Example, CN = example.com
i:C = US, O = DigiCert Inc, CN = DigiCert TLS RSA SHA256 2020 CA1
1 s:C = US, O = DigiCert Inc, CN = DigiCert TLS RSA SHA256 2020 CA1
i:C = US, O = DigiCert Inc, CN = DigiCert Global Root CA
---
SSL handshake has read 3847 bytes and written 444 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
The depth lines show certificate chain validation—depth 0 is the server's certificate, higher numbers are the chain leading to the root CA. verify return:1 means each certificate passed validation.
Speaking Protocols by Hand
Once connected, you can type protocol commands directly. For HTTPS:
openssl s_client -connect example.com:443
Then type:
GET / HTTP/1.1
Host: example.com
(Press Enter twice after the Host line.)
You'll see the raw HTTP response—headers and body—proving the encrypted connection works end-to-end.