FormatterHQ

Self-Signed Certificate Generator

Create a self-signed TLS certificate and matching RSA private key for local development, test servers or internal tools, with the hostnames and IP addresses you need.

Output TEXT
Ready.

How to use the Self-Signed Certificate Generator

  1. Enter the Common Name (the default is localhost) and the Extra SANs: hostnames and IP addresses separated by commas.
  2. Set Valid for (days), and optionally an Organization and Country code.
  3. Choose an RSA key size. Tick Make it a CA certificate only if you want to sign other certificates with it.
  4. Click Generate certificate, then save the CERTIFICATE block as a .crt file and the PRIVATE KEY block as a .key file.

What this self-signed certificate generator makes

A self-signed certificate is signed by its own key instead of a certificate authority. This self-signed certificate generator creates a new RSA key pair and a certificate in which the issuer and subject are the same, with the Subject Alternative Names you list. It is the quickest way to run HTTPS on localhost, a Docker container, a Raspberry Pi or an internal dashboard.

When a self-signed certificate is the right choice

Self-signed certificates encrypt traffic just like CA-issued ones, but no browser trusts them by default. They suit development machines, automated tests, service-to-service links where you control both ends, and lab equipment. For a public website, use a certificate from a public CA and create the request with the CSR generator.

Example

With the defaults (CN localhost, SANs 127.0.0.1, ::1, dev.local, 365 days), the generated certificate decodes to:

Subject:        CN=localhost
Issuer:         CN=localhost   (self-signed)
Status:         valid (364 days left)
Signature:      sha256WithRSAEncryption
Public key:     RSA 2048 bit, e=65537
Names (SAN):    DNS:localhost, IP:127.0.0.1, IP:0000:0000:0000:0000:0000:0000:0000:0001, DNS:dev.local

Extensions:
  basicConstraints (critical): {"CA":false}
  keyUsage (critical): digitalSignature, keyEncipherment
  extKeyUsage: serverAuth (TLS Web Server Authentication), clientAuth (TLS Web Client Authentication)

Paste your own result into the SSL certificate decoder to confirm the names and dates before you deploy it.

Options explained

  • Common Name: stored as the subject and issuer CN and added as the first SAN.
  • Extra SANs: IPv4 and IPv6 addresses become IP entries and everything else becomes a DNS name. Browsers match only these names, so list every hostname and IP you will type into the address bar.
  • Valid for (days): 1 to 10,950 days. The start time is set one minute in the past to allow for small clock differences. Apple platforms reject TLS server certificates valid for more than 825 days, so the default of 365 is a safe choice.
  • RSA key size: 2048, 3072 or 4096 bits. The certificate is signed with SHA-256.
  • Make it a CA certificate: sets basicConstraints CA:true and key usage keyCertSign and cRLSign, and leaves out the server and client auth usages. Use it as a private root, then sign server certificates with openssl.

Using the certificate

Save the two blocks as localhost.crt and localhost.key. In nginx, point ssl_certificate and ssl_certificate_key at them. In Node.js, pass both files to https.createServer({ key, cert }). To stop browser warnings, import the .crt into your operating system or browser trust store as a trusted certificate. Only do this for certificates you generated yourself.

Common errors and fixes

  • NET::ERR_CERT_COMMON_NAME_INVALID: the host in the address bar is not in the SAN list. Add it and generate again.
  • Still untrusted after importing: make sure you imported the certificate into the trusted root store, not the personal store, and restart the browser.
  • Key and certificate mismatch: every run creates a new key. Always keep the key and certificate from the same run together.

Privacy

The RSA key pair is generated with WebCrypto and the certificate is signed with node-forge, both in your browser. Neither the key nor the certificate is sent to a server. For JWT or SSH keys rather than TLS certificates, see the RSA key generator.

Frequently asked questions

Why does my browser still show a warning for a self-signed certificate?
Browsers only trust certificates that chain to a root in their trust store. Import the certificate as a trusted root on your machine, or create a CA certificate, trust it, and sign your server certificates with it.
Can I use a self-signed certificate for an IP address?
Yes. Put the IP address in the Extra SANs field and it is added as an IP entry, which browsers require for HTTPS on a bare address such as 127.0.0.1 or 192.168.1.10.
How long should a self-signed certificate be valid?
For development, a year is typical. Apple platforms reject TLS server certificates valid for more than 825 days, and shorter lifetimes limit the damage if a key leaks, so avoid very long validity for server certificates.
Does the tool create an EC or Ed25519 certificate?
No, it generates RSA certificates only, which every TLS client supports. If you need an EC certificate, create the key with the ECDSA key generator and sign the certificate with openssl.
Is the private key protected with a password?
No. It is an unencrypted PKCS#8 PEM key, which development servers load without prompts. Keep the file out of version control and restrict its permissions.

Last updated September 26, 2026

Related tools

SSL Certificate Decoder (X.509) Decode PEM or DER X.509 SSL/TLS certificates: subject, issuer, SANs, validity, key type, extensions and SHA-256 fingerprints. SHA-1 Hash Generator Generate the SHA-1 hash of any text or file online. Instant 160-bit digest in hex, computed in your browser. SHA-2 Hash Generator Generate SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 or SHA-512/256 hashes from text or files. SHA-224 Hash Generator Generate the SHA-224 hash of any text or file online. Instant 224-bit digest in hex, computed in your browser. SHA-256 Hash Generator Generate the SHA-256 hash of any text or file online. Instant 256-bit digest in hex, computed in your browser. SHA3-224 Hash Generator Generate the SHA3-224 hash of any text or file online. Instant 224-bit digest in hex, computed in your browser. SHA3-256 Hash Generator Generate the SHA3-256 hash of any text or file online. Instant 256-bit digest in hex, computed in your browser. SHA3-384 Hash Generator Generate the SHA3-384 hash of any text or file online. Instant 384-bit digest in hex, computed in your browser. SHA3-512 Hash Generator Generate the SHA3-512 hash of any text or file online. Instant 512-bit digest in hex, computed in your browser. SHA-384 Hash Generator Generate the SHA-384 hash of any text or file online. Instant 384-bit digest in hex, computed in your browser. SHA-512/224 Hash Generator Generate the SHA-512/224 hash of any text or file online. Instant 224-bit digest in hex, computed in your browser. SHA-512/256 Hash Generator Generate the SHA-512/256 hash of any text or file online. Instant 256-bit digest in hex, computed in your browser.