Login/Register

Self-Signed Certificate Generator

Create a certificate and its private key in one step, for localhost, a test environment or a server inside your network. Add as many host names and IP addresses as you need.

One per line. Wildcards and IP addresses are allowed.

What a self-signed certificate is good for

It encrypts the connection exactly like a bought certificate, but nobody has verified who it belongs to, so browsers show a warning. That is fine where you control both ends: a development machine, a staging server, a router, a database connection or a service that is reachable only inside the company.

For a website that other people visit it is the wrong choice. Visitors see "Your connection is not private" and leave.

How to make your own computer trust it

  • Windows: double-click the .crt file, Install certificate, store "Trusted Root Certification Authorities".
  • macOS: open it in Keychain Access, then set "Always trust" for the certificate.
  • Linux: copy it to /usr/local/share/ca-certificates/ and run update-ca-certificates.

After that the browser on this computer opens the site without a warning.

The same with OpenSSL

openssl req -x509 -newkey rsa:2048 -nodes -days 365 -keyout server.key -out server.crt -subj "/CN=localhost" -addext "subjectAltName=DNS:localhost,IP:127.0.0.1"

Generating the certificate on your own machine keeps the private key there. Use the command for anything that is more than a test.

Questions and answers

Is the private key stored?
No. The key is generated, shown to you once and discarded. Because it travels over the internet to reach you, use these certificates for development and tests, and generate keys for important systems on the system itself.
Why does the browser still warn me?
Because the certificate is not signed by an authority the browser knows. Add it to the trusted certificates of your computer as described above.
Can I use it on a public website?
Technically yes, but every visitor gets a security warning. A domain-validated certificate costs a few dollars a year and removes the warning for everybody.
Why do I have to list the host name again under "more names"?
You do not: the first name is added to the Subject Alternative Names automatically. Browsers only read that list, the common name alone is ignored.