What Is Certificate Pinning?
Certificate pinning means a client accepts only a specific certificate or public key for a server, instead of any certificate signed by a trusted CA. The goal is to stop an attacker who obtains a fraudulent certificate from a CA, or who installs a rogue root on a device, from intercepting traffic.
How certificate pinning works
The client stores an expected value, usually the hash of the server public key (SPKI). During the handshake it compares the server certificate chain against that value. If none matches, the connection is refused even if the certificate is otherwise valid.
What you can pin
| Pin target | Survives renewal? | Risk |
|---|---|---|
| Leaf certificate | No, changes at every renewal | Breaks often |
| Leaf public key | Yes, if you reuse the key | Locks you to one key |
| Intermediate CA key | Usually | Depends on the CA staying the same |
| Backup key | Yes | Needed so you can rotate safely |
HPKP is gone
HTTP Public Key Pinning let websites send pins in a header. It was removed from major browsers because a wrong pin or a hostile pin could lock visitors out of a site for months. Do not try to use it today. Browsers now rely on Certificate Transparency logs and CAA records instead.
Pinning in mobile apps
Apps are the main place pinning still appears, because the developer controls both client and server. Typical use is in banking and payment apps. A pinned app must be updated before the server key changes. If you rotate keys without shipping a new app version, users get connection errors.
| Platform | Common approach |
|---|---|
| Android | Network Security Configuration with pin-set and expiration |
| iOS | Pinning in the URL session delegate or a configured pinned domain list |
| Cross-platform | A pinning library or the networking layer of the framework |
Certificate pinning risks
- Locking yourself out when certificates change.
- Short-lived certificates make pinning to a leaf impractical.
- Corporate proxies that inspect traffic will break pinned apps.
- Pins hard-coded in releases can be wrong for months.
Better options for most sites
- Use Certificate Transparency monitoring to detect certificates issued for your domain.
- Publish CAA records listing the CAs allowed to issue. Check them with the CAA Checker.
- Serve HSTS so browsers refuse HTTP downgrades.
- Automate renewals and verify the live chain with the SSL Checker.
If you must pin
Pin the public key, not the certificate. Include at least one backup key that is not yet deployed. Add a pin expiry in the client, and plan the rotation before certificates renew. Test the failure path as well as the success path.
Practical notes
A practical test of whether pinning suits your project is to ask who controls the client. If you ship an app and can force an update, and your server keys change rarely, pinning with a backup key is manageable. If clients are browsers, third-party integrations or old devices you cannot update, pinning will eventually cause an outage. In that case rely on Certificate Transparency monitoring, CAA records and short, automated certificate renewals, which fix the same problem with less risk.
Related reading: certificate transparency, protecting SSL private keys and SSL expiration alerts.
Frequently Asked Questions
Do websites still use certificate pinning?
Browsers dropped pinning headers. Pinning now lives mostly in mobile and desktop apps that talk to their own servers.
Does pinning work with Let's Encrypt?
Yes, if you pin a public key you control. Pinning the leaf certificate does not work with short-lived certificates, because the leaf changes at every renewal.
What happens when a pin does not match?
The client refuses to connect, even if the certificate is valid and trusted.
Is pinning needed for normal websites?
No. HTTPS with HSTS, CAA and monitoring covers the realistic risks for most sites.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.