A self-signed certificate is a TLS certificate signed by the same entity that uses it, instead of by a publicly trusted certificate authority. It encrypts traffic, but browsers do not trust it because no independent authority verified who owns the domain, so visitors see a security warning.
Key takeaways
- A self-signed certificate encrypts traffic but provides no identity proof, so browsers warn and many clients refuse the connection.
- It is acceptable for local development and closed internal testing where you control trust, but not for public websites.
- For anything public, use a certificate from a trusted CA — free options such as Let's Encrypt cover most sites.
You open a site and your browser stops you: the connection is not private, the certificate is self-signed. The site might be perfectly legitimate — or it might be an impostor. The warning exists because, with a self-signed certificate, your browser cannot tell the difference.
What is a self-signed certificate?
A self-signed certificate is a TLS certificate that is signed by the same entity that uses it, instead of by a publicly trusted certificate authority (CA). The issuer and the subject are the same, and the signature is made with the certificate's own private key.
Normally, a CA verifies that you control a domain before issuing a certificate, and browsers trust certificates signed by CAs in their root store. A self-signed certificate skips that whole process. It still encrypts traffic between the browser and the server, but it provides no independent proof of who runs the server.
That distinction is the whole story. Encryption without identity verification protects you from passive eavesdropping, but not from an attacker who presents their own self-signed certificate for the same domain. Your browser has no way to know which one is real.
How does a self-signed certificate work?
TLS certificate validation follows a chain of trust defined in RFC 5280. Your browser checks that the certificate is signed by a CA it trusts, that it matches the domain you visited, and that it has not expired or been revoked.
A self-signed certificate fails the first check by definition. Its issuer and subject fields are identical, and no trusted root vouches for it. Chromium-based browsers show ERR_CERT_AUTHORITY_INVALID, and other browsers show a similar warning. Many automated clients — curl, Python's requests library, Java, and mobile apps — refuse the connection entirely unless explicitly told to skip validation.
Creating one is quick. With OpenSSL, a single command generates a private key and a certificate valid for a year. That ease is part of the appeal for testing, and part of the risk: anyone can generate a self-signed certificate for any domain, including your bank's, in seconds.
Self-signed vs CA-signed: what's the difference?
The difference is not encryption — both encrypt traffic. The difference is trust, verification, and what happens when something goes wrong.
| Self-signed certificate | CA-signed certificate | |
|---|---|---|
| Who signs it | The server owner, with their own key | A publicly trusted certificate authority |
| Identity verified | No — anyone can claim any domain | Yes — the CA checks domain control |
| Trusted by browsers | No, warning shown by default | Yes, padlock shown |
| Revocation | No standard mechanism (no CRL or OCSP) | Yes, via CRL and OCSP |
| Validity period | Chosen by the creator, can be years | Limited by CA/Browser Forum rules |
| Cost | Free | Free (Let's Encrypt) or paid |
| Best for | Local development, closed testing | Public websites and APIs |
Public CA certificates are also logged in Certificate Transparency logs, which makes mis-issuance visible. Self-signed certificates never appear there, so there is no public record and no accountability if one is abused.
What are the risks of self-signed certificates?
The risks fall into four groups, and they compound each other. A certificate that is fine on a developer's laptop can become a real vulnerability the moment it reaches a shared or public service.
- Man-in-the-middle attacks. Because no CA verified the server, an attacker can substitute their own self-signed certificate and intercept traffic. Users who click through warnings cannot distinguish the real server from the impostor.
- Phishing. Anyone can generate a self-signed certificate for any domain. Attackers use them on convincing fake login pages, and the presence of HTTPS — even with a warning clicked through — can reassure victims.
- No revocation. CA-signed certificates can be revoked through CRLs and OCSP when a key is compromised. Self-signed certificates have no such mechanism, so a stolen private key can be abused for the certificate's entire lifetime.
- Long lifetimes and stale cryptography. Self-signed certificates can be set to last for years, locking in older algorithms and key sizes. Public CA certificates are now limited to short lifetimes, which forces regular renewal and upgrades.
- Broken clients and compliance failures. Many APIs, mobile apps, and services refuse self-signed certificates by default. Standards such as PCI DSS prohibit them for handling sensitive data, and audit findings commonly flag them on production systems.
There is also a human cost: warnings train people to click through security alerts. Once users learn that warnings are routine on internal tools, they are more likely to click through a real warning on a phishing site.
When is a self-signed certificate acceptable?
Self-signed certificates are acceptable in closed environments where you control trust yourself and no member of the public will ever see the warning. The classic cases are local development, automated tests, and internal services on a private network.
For local development, a self-signed certificate lets you test HTTPS behavior on localhost without buying or requesting a certificate. For internal testing, it works when every client is a machine you manage and you install the certificate in each client's trust store yourself.
Even there, a better option often exists. Tools such as mkcert create a local CA and install it in your trust stores, giving you properly validated local certificates. For internal services, run your organization's own private CA and distribute its root certificate to company devices — that gives you revocation, expiry control, and a single trust anchor to manage.
When should you never use a self-signed certificate?
Never use one on a public-facing website, API, or customer portal. Visitors will see a warning, many will leave, and those who click through are being trained to ignore the exact warning that protects them from phishing.
Never use one for anything handling sensitive data: logins, payments, health information, or personal data. Compliance frameworks, including PCI DSS, explicitly prohibit self-signed certificates for sensitive traffic, and auditors will flag them.
For the full risk list, see Sectigo's guide to self-signed certificates.
The underlying validation rules are defined in RFC 5280, the X.509 certificate profile.
Certificate problems often show up alongside wider network issues, so review our guide to securing your Wi-Fi as well.
Never use one as a permanent fix for an expired CA certificate. If a public certificate expired, renew it — a self-signed replacement hides the outage from monitoring while breaking trust for every visitor. Set up expiry monitoring instead: our free SSL checker shows a certificate's issuer, expiry, and chain in seconds.
How do you create a self-signed certificate?
Use OpenSSL, which is installed on most Linux and macOS systems and available on Windows. The command below creates a 2048-bit RSA private key and a certificate valid for 365 days.
Run openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes and answer the prompts for country, organization, and common name — the common name should match the hostname you will use, such as localhost. The -nodes flag means the private key is not encrypted with a passphrase, which is convenient for testing but means anyone who reads the file can use the key.
Keep the private key secret and never commit it to a code repository. Use a strong key size — 2048-bit RSA as a minimum, or an ECDSA P-256 key — and set a short validity period so a forgotten certificate does not linger for years. For production, replace it with a CA-signed certificate before anyone else connects.
How do you replace a self-signed certificate?
Replacing one is straightforward, and free for most sites. Get a certificate from Let's Encrypt, which issues domain-validated certificates at no cost through the ACME protocol defined in RFC 8555, or buy one from a commercial CA if you need extended validation or a warranty.
- Prove domain control. The CA will ask you to place a file on your server or add a DNS record. This is the verification a self-signed certificate skips.
- Install the certificate and private key. Put them on your web server and configure it to serve the full chain, including intermediates.
- Test the result. Use an SSL checker to confirm the chain is complete, the domain matches, and the expiry date is correct.
- Automate renewal. Let's Encrypt certificates last 90 days, so set up automatic renewal. A certificate that expires is almost as bad as a self-signed one.
- Remove the old certificate. Revoke or delete the self-signed certificate and remove it from any trust stores where you installed it.
For internal services, the replacement is a private CA: issue short-lived certificates from it, distribute the root to company devices through device management, and set up revocation so a compromised key can be invalidated quickly.
The bottom line
A self-signed certificate encrypts traffic but proves nothing about identity, which is why browsers warn about it and why it has no place on a public website or anywhere sensitive data flows.
Use it for local development and closed testing, use a private CA for internal services, and use a trusted CA — free from Let's Encrypt — for anything public. Check your own site's certificate with our free SSL checker and replace any self-signed certificate you find facing the internet.
Frequently asked questions
What is a self-signed certificate in simple terms?
It is a security certificate a server creates and signs itself, instead of asking a trusted certificate authority to verify it. It encrypts the connection, but nobody independent has confirmed the server is who it claims to be.
Are self-signed certificates safe?
They are safe only in closed environments you control, such as local development or an internal test server where you install the certificate as trusted yourself. They are not safe for public websites, because anyone can create one for any domain name.
Why does my browser warn about a self-signed certificate?
Your browser keeps a list of trusted certificate authorities. A self-signed certificate is not signed by any of them, so the browser cannot verify the site's identity and shows an error such as ERR_CERT_AUTHORITY_INVALID. Clicking through removes that protection.
Can I use a self-signed certificate for a public website?
You should not. Visitors will see a security warning, many will leave, and search engines and some services may refuse to connect. Use a certificate from a publicly trusted CA instead, including free options such as Let's Encrypt.
How do I create a self-signed certificate?
With OpenSSL, run openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365. That creates a private key and a certificate valid for a year. Use it only for testing, and keep the private key secret.
What is the difference between a self-signed and a CA-signed certificate?
A CA-signed certificate is issued after a certificate authority verifies you control the domain, and browsers trust it automatically. A self-signed certificate skips that verification, so browsers do not trust it and there is no revocation system if the key is compromised.
Do self-signed certificates expire?
They expire when the creator sets them to expire, and the validity period is chosen by whoever generates the certificate. Some are set to last for years, which is a risk: if the private key is compromised, there is no standard way to revoke the certificate.
What should I use instead of a self-signed certificate?
For public sites, use a free certificate from Let's Encrypt or a paid certificate from a trusted CA. For internal services, use your organization's private CA and distribute its root certificate to company devices, or use a short-lived certificate from an internal automation system.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against RFC 5280, Sectigo and ManageEngine guidance on self-signed certificates, and SSL.com's vulnerability overview.
How we write and fact-check →