What Is a Self-Signed SSL Certificate?
A self-signed SSL certificate is signed with its own private key instead of a certificate authority's. The issuer and the subject are the same entity. The encryption works, but nobody outside your machine has a reason to trust the identity it claims, so browsers warn.
Why browsers warn about a self-signed SSL certificate
Browsers ship with a list of trusted root CAs. A certificate is accepted if it chains up to one of them. A self-signed certificate does not chain to any, so the browser shows a warning such as "Your connection is not private". Users can click through, but that trains them to ignore real warnings, and a man-in-the-middle attacker can present their own self-signed certificate that looks identical.
Create a self-signed SSL certificate with OpenSSL
openssl req -x509 -newkey rsa:2048 -nodes -days 365 \
-keyout local.key -out local.crt \
-subj "/CN=localhost" \
-addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
Always include the SAN field. Modern browsers ignore the Common Name. The -addext option needs OpenSSL 1.1.1 or newer.
Where self-signed is acceptable
- Local development on your own machine.
- Short-lived test environments.
- Internal services where you control both client and server and can pin or install the certificate.
- Learning and experiments.
Where it is a bad idea
- Public websites. Every visitor gets a warning.
- Anything with logins or payments.
- APIs consumed by third parties. Clients will reject the certificate, or users will switch off verification, which defeats the point of TLS.
- Production systems where "just disable verification" becomes the quiet workaround.
Better local options
Instead of clicking through warnings, create your own small CA and trust it on your devices. Tools such as mkcert do this: they create a local CA, add it to your system and browser trust stores, and issue certificates signed by it. The warnings disappear on your machine only. Do not share the CA key.
Self-signed versus CA-signed
| Self-signed | CA-signed (free or paid) | |
|---|---|---|
| Browser trust | None by default | Trusted by default |
| Cost | Free | Free to paid |
| Encryption | Yes | Yes |
| Identity assurance | None | At least domain control |
| Renewal | Manual | Automatic with ACME |
| Public use | No | Yes |
Getting a trusted certificate is free now. Our guide to free certificate providers helps you choose, and the hosting provider SSL comparison covers hosts that bundle certificates. If you are deciding between free and self-signed, the next step is to compare them directly.
Using one with Java or Spring
Java apps often need a keystore. You can bundle a self-signed key in a PKCS12 file for development. See converting PEM to a Java keystore and enabling HTTPS in Spring Boot.
Moving to production
- Get a certificate from a trusted CA through ACME.
- Install the full chain.
- Remove all code and config that disables certificate verification.
- Add a redirect from HTTP to HTTPS.
Trusting a self-signed certificate on purpose
If you must use one, install the certificate itself into the trust store of every client that needs it, instead of disabling verification. With curl, pass it explicitly:
curl --cacert local.crt https://localhost:8443/
This keeps verification on and trusts only that one file. In Node.js, set the NODE_EXTRA_CA_CERTS environment variable to the file path. In Java, import it into a truststore. Each approach has a small footprint and is easy to undo.
Risks to remember
- Do not reuse the same private key across environments.
- Do not commit private keys to version control.
- Do not leave a one-year certificate running unnoticed. It expires and breaks things on a day nobody expects.
- Do not turn a development workaround into a production default.
See also Check If a Certificate Matches Its Private Key when you juggle several local files and are not sure which key belongs to which certificate.
Expiry and rotation
Because nothing renews a self-signed certificate for you, put its expiry date in a calendar or a script. Many developers choose a long lifetime to avoid the chore, then forget the file exists. A short lifetime with a simple regeneration script is safer and keeps good habits for the day you move to a trusted CA.
Document where each self-signed certificate is used, who trusts it, and how to replace it. A one-page note saves hours when it expires during an incident.
Related reading: free SSL on localhost and how root stores decide trust.
Frequently Asked Questions
Is a self-signed certificate encrypted?
Yes. The traffic is encrypted the same way. What is missing is proof that the server is the one you meant to reach.
Can I make browsers trust one?
Yes, by importing the certificate into the trust store of each client. That is fine for a lab or an internal service you control.
How long should a self-signed certificate last?
Long enough to be useful, short enough that you notice. A short lifetime with a regeneration script beats a one-year file nobody remembers.
Does it work for an API?
Only if every client is configured to trust it. Third-party clients will reject it, and telling them to disable verification defeats the purpose.
What should I use for local development instead?
A local CA such as mkcert. It installs a root in your trust stores and issues certificates that browsers accept without warnings.
✅ 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.