b2KIT

Self-Signed Certificate Generator

Generate self-signed X.509 certificates with custom subject, validity period, and key algorithm for development use.

Tested tool guide Tested browser tools Checked August 16, 2026

What Self-Signed Certificate Generator does, with a checked example

This tool builds a self-signed X.509 certificate in your browser: you pick the subject name (common name, organization, country, and so on), the validity period, and the key algorithm, and you get the certificate and its private key as downloadable PEM files. 'Self-signed' means the certificate is signed by the key it carries, so subject and issuer are the same name. The thing most people get wrong: nothing trusts this certificate until you install it in a device's trust store, and even then the hostname you visit must appear in its subjectAltName.

Worked example

A concrete input and expected output from the current implementation.

Input

Common name: localhost; organization: Local Development; validity: 365 days; key: RSA 2048

Expected output

A PEM certificate (-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----) and its matching private key. The certificate decodes to: Subject CN = localhost, O = Local Development; Issuer CN = localhost, O = Local Development (identical, so self-signed); valid 2026-08-16 to 2027-08-16; public key RSA 2048.

Self-signed means the certificate is signed by the key it carries, so subject and issuer are necessarily the same. 365 days after 2026-08-16 falls on 2027-08-16 because the interval contains no February 29.

How the result is produced

1

Key pair and self-signature

The tool creates a key pair in the algorithm you choose, then builds the certificate around it: the subject fields you entered, an issuer set to the same name, the validity window you picked, and a serial number. Signing with the certificate's own private key is what makes it self-signed, and both files come back in PEM form.

2

Hostname matching

Modern browsers and TLS clients match the address in the URL against the subjectAltName extension (DNS names and IP addresses) and do not consult the CN field for hostname validation. A certificate for localhost with no SAN entry, or a SAN covering a different host, is rejected with a warning even when the certificate is well formed and present in the trust store.

Good uses

  • Local HTTPS development: create a certificate for localhost or 127.0.0.1, install it or accept the warning, and work with secure cookies, service workers, and camera or microphone permissions the way they behave in production.
  • Mutual TLS testing: generate a client certificate for each test client and have your mTLS test server require them, exercising authentication, rejection, and expiry handling without buying CA-issued certificates.
  • Exercising your own validation code: generate certificates with different subjects, key algorithms, and validity lengths, and confirm your application accepts the valid ones and rejects expired or wrong-host ones.

Limits and checks

  • Trust is installed, not granted. The tool produces the certificate; it cannot make anything trust it. You must add it to the store the client actually reads (the System keychain on macOS, the OS store elsewhere) and mark it trusted - and the address you connect to must still match the subjectAltName, or the warning stays.
  • The private key is yours to keep and to lose. The key pair is generated and downloaded in your browser with no server-side copy, so a lost key file means no recovery, and anyone holding the file can impersonate the certificate's owner.
  • Validity limits that do not apply. Publicly trusted certificates are capped at a short maximum validity by the CA/Browser Forum, but no such cap applies to a self-signed certificate, so a long-lived test certificate is permitted. It still expires on the date you chose, and an expired certificate fails everywhere.

Common questions

Why does my browser still show a warning after I installed the certificate?

Almost always one of two things: the name you typed does not match the certificate's subjectAltName (localhost and 127.0.0.1 are different names), or the certificate landed in a store the browser does not read, such as the Login keychain on macOS instead of System, or without being marked trusted. Check the SAN covers the exact host, then reinstall with trust enabled.

Can I use this certificate on a production site?

Not in the usual sense. Browsers and most TLS clients reject a self-signed certificate in production because it does not chain to a publicly trusted root, and no setting changes that. For public traffic you need a certificate from a public CA. For internal services, the working alternative is installing this certificate into each client's trust store.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools