Home › Developer Tools › Self-Signed Certificate Generator

Self-Signed Certificate Generator

Create a self-signed X.509 certificate and private key for localhost, test servers and internal tools. Add every hostname and IP as a SAN, pick the validity, then download PEM files or a password-protected PFX. Everything is generated on your device.

Last updated:

Names

More subject fields (optional)

Certificate

Certificate type
Advertisement
Advertisement

How to use the Self-Signed Certificate Generator

  1. Enter the hostnames the certificate should cover. The default localhost, 127.0.0.1 and ::1 suits local development.
  2. Choose the validity in days and the key type. RSA 2048 works everywhere; ECDSA P-256 is smaller and faster.
  3. Press Generate certificate. The certificate and private key appear as PEM text.
  4. Download the .crt and .key files for nginx, Apache or Node.js, or set a password and download the .pfx for Windows, IIS or .NET.
  5. Trust the certificate on your computer (see the instructions below) so browsers stop showing a warning.

Trust the certificate on your computer

A self-signed certificate is only accepted after you add it to a trust store. Use the .crt file (never share the key):

SystemHow to trust the certificate
macOSDouble-click the .crt to add it to Keychain Access (System keychain), open it, expand Trust and set When using this certificate to Always Trust. Or run sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain localhost.crt
WindowsDouble-click the .crt, choose Install Certificate, Local Machine, then Place all certificates in the following store and pick Trusted Root Certification Authorities. PowerShell: Import-Certificate -FilePath localhost.crt -CertStoreLocation Cert:\LocalMachine\Root
Ubuntu / Debiansudo cp localhost.crt /usr/local/share/ca-certificates/ && sudo update-ca-certificates
Fedora / RHELsudo cp localhost.crt /etc/pki/ca-trust/source/anchors/ && sudo update-ca-trust
FirefoxSettings, Privacy & Security, View Certificates, Authorities, Import, tick Trust this CA to identify websites. (Or enable security.enterprise_roots.enabled to use the system store.)
Node.js clientsNODE_EXTRA_CA_CERTS=./localhost.crt node app.js

Restart the browser after importing. If Chrome still reports NET::ERR_CERT_COMMON_NAME_INVALID, the hostname in the address bar is missing from the Subject Alternative Names.

Which file format do I need?

FileContainsUsed by
.crtCertificate only (PEM text)nginx ssl_certificate, Apache SSLCertificateFile, trust stores
.keyUnencrypted PKCS#8 private key (PEM)nginx ssl_certificate_key, Apache SSLCertificateKeyFile, Node.js
.pem bundleCertificate followed by key in one fileHAProxy, some Python and Go servers, webpack-dev-server
.pfx / .p12Certificate and encrypted key, password-protected (PKCS#12)Windows, IIS, Kestrel / ASP.NET, Java keystores, Azure

What this tool puts in the certificate

  • X.509 version 3 with a random 128-bit serial number and a start time 5 minutes in the past to tolerate small clock differences.
  • Subject Alternative Names for every DNS name and IP address you list (browsers require them).
  • Server / TLS: Basic Constraints CA:FALSE, Key Usage digitalSignature (plus keyEncipherment for RSA) and Extended Key Usage serverAuth and clientAuth.
  • Root CA: Basic Constraints CA:TRUE and Key Usage keyCertSign, cRLSign, so you can sign other certificates with openssl x509 -req -CA ca.crt -CAkey ca.key ….
  • Subject and Authority Key Identifiers (SHA-1 of the public key), as OpenSSL adds by default.

Frequently asked questions

What is a self-signed certificate?

It is an X.509 certificate signed with its own private key instead of by a certificate authority. It encrypts traffic just like a CA-issued certificate, but browsers show a warning until you explicitly trust it, because no third party has vouched for it. That makes it ideal for localhost, test environments and internal services, but not for public websites.

Why does the browser still show a warning?

Browsers only trust certificates that chain to a root in their trust store. Import the .crt file into your operating system or browser trust store (instructions below) and restart the browser. Also make sure the hostname you visit is listed in the Subject Alternative Names: Chrome ignores the Common Name.

Should I make a server certificate or a root CA?

For a single dev server a server certificate is simplest: trust it directly. If you have several local sites, create a root CA here, trust it once, then sign per-site certificates with it using OpenSSL. Never share a trusted root CA key: anyone holding it could impersonate any website on your machine.

How long should a self-signed certificate be valid?

For local development one or two years is practical. Apple platforms reject TLS server certificates valid for more than 825 days, so stay under that if you test on macOS or iOS. Public certificate authorities are limited to 398 days, but that rule does not apply to certificates you trust manually.

What password does the PFX file use?

The one you type in the PFX password field. The private key inside the PFX is encrypted with AES-256 (PBES2, PBKDF2-SHA256) and the file is protected with a SHA-256 MAC, the same defaults OpenSSL 3 uses. Windows 10 1709 and later, .NET and Java read it. Very old systems may need: openssl pkcs12 -in cert.pfx -nodes | openssl pkcs12 -export -legacy -out legacy.pfx.

Is it safe to generate a private key in the browser?

The key pair is created by the browser's Web Crypto API with a cryptographically secure random number generator, and nothing is uploaded or stored. For production keys follow your organisation's policy, which may require generating keys on the server or in a hardware module.

Can I use this certificate for a public website?

You can, but every visitor would see a security warning. For public sites use a free certificate authority such as Let's Encrypt, which issues browser-trusted certificates automatically.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

CSR GeneratorCreate a certificate signing request (CSR) and private key with SANs, RSA or ECDSA, in your browser.SSL Certificate DecoderDecode PEM SSL/X.509 certificates: subject, issuer, expiry, SANs, key and fingerprints.RSA Key GeneratorGenerate 2048, 3072 or 4096-bit RSA key pairs as PEM, PKCS#1, JWK or OpenSSH, locally.Hash GeneratorGenerate MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.CSR DecoderDecode a PEM certificate signing request: subject, SANs, key size, signature and CA readiness checks.Password GeneratorCreate strong passwords and passphrases.MD5 Hash GeneratorGenerate MD5 hashes of text, lines or files and verify checksums.SHA-256 Hash GeneratorSHA-256 and HMAC-SHA256 hashes of text, lines or files, in hex or Base64.Base64 Encoder DecoderEncode or decode Base64 text and files, and make data URIs.URL Encoder DecoderPercent-encode or decode URLs, query strings and form data.HTML Entity Encoder / DecoderEscape and unescape HTML entities, named or numeric.Bcrypt Hash Generator & CheckerCreate bcrypt password hashes and check a password against a hash.Binary TranslatorConvert text to binary, hex, octal and back.HMAC GeneratorGenerate and verify HMAC signatures with SHA-256, SHA-512, SHA-1 or MD5.CRC32 Checksum CalculatorCalculate CRC-32, CRC-32C, CRC-16 and Adler-32 checksums of text or large files.JWT DecoderDecode JSON Web Tokens, read the claims and expiry, and verify HS256 signatures.JWT GeneratorCreate and sign HS256, HS384 or HS512 JSON Web Tokens in your browser and verify them.Password Strength CheckerSee how strong a password really is, how long it takes to crack and how to improve it.Caesar CipherEncode and decode Caesar shift ciphers and crack unknown shifts with a ranked brute force.Vigenère CipherEncrypt and decrypt Vigenère and Autokey ciphers, and crack unknown keys with frequency analysis.Atbash CipherEncode and decode Atbash ciphers (A↔Z, B↔Y) in Latin or Hebrew, with a live letter mapping table.ASCII TableFull ASCII code chart 0–255 in decimal, hex, octal, binary and HTML, with search and copy.Unicode Character LookupFind Unicode characters by name or code point and copy them with UTF-8, HTML and code escapes.Punycode ConverterConvert international domain names, emails and URLs between Unicode and xn-- Punycode, in bulk.JSON Escape / UnescapeEscape text for a JSON string, unescape \n and \" back to text, or stringify a whole object.Binary to HexConvert binary to hex instantly with steps and signed mode.Hex to BinaryConvert hex to binary instantly with steps and signed mode.Binary CalculatorAdd, subtract, multiply, divide, AND, OR, XOR and shift binary numbers with decimal values.Hex CalculatorHexadecimal + − × ÷ and AND, OR, XOR, NOT, shifts with decimal and binary equivalents.Base32 Encoder / DecoderEncode and decode Base32 (RFC 4648), Base32hex, Crockford and z-base-32 from text, hex or files.Base58 Encoder / DecoderEncode and decode Base58 and Base58Check (Bitcoin alphabet) from text or hex, with checksum verification.Unicode Escape / UnescapeConvert text to \uXXXX, \u{...}, \x, &#...; or CSS escapes and decode them back.File Hash CheckerGet MD5, SHA-1, SHA-256 and SHA-512 checksums of files and verify them against a hash.TOTP GeneratorGenerate 2FA one-time codes from a secret key, create otpauth QR codes and verify codes.Text Encryption ToolEncrypt and decrypt text with a password using AES-256-GCM, entirely in your browser.Argon2 Hash GeneratorHash passwords with Argon2id, Argon2i or Argon2d and verify them against an encoded hash.Base64 to PDFDecode a Base64 string to a PDF with preview and download, or encode a PDF to Base64.Bitwise CalculatorCalculate AND, OR, XOR, NOT and bit shifts at 8–64 bits with a bit grid and all bases.String Escape / UnescapeEscape or unescape strings for JavaScript, Java, C#, Python, C, SQL, regex, CSV and shell.UTF-8 Encoder / DecoderConvert text to UTF-8 bytes in hex, decimal, binary, \x or % and decode bytes back to text.UUID Decoder & ValidatorDecode any UUID: version, variant, v1/v6/v7 timestamp and MAC node, plus bulk validation.Base64 to FileDecode Base64 or a data URI to a downloadable file; detects the real file type and previews it.File Encryption ToolEncrypt and decrypt any file with a password using AES-256-GCM, entirely in your browser.Passphrase GeneratorMake strong, memorable diceware passphrases from a 7,776-word list, with entropy in bits.Enigma Machine SimulatorEncrypt and decrypt with a virtual Enigma I, M3 or M4: rotors, rings, plugboard and lampboard.Hex Opacity CalculatorConvert opacity percent to a 2-digit HEX alpha code and full #RRGGBBAA color, with a 0-100% table.Playfair CipherEncrypt and decrypt Playfair ciphers from a keyword, with the 5x5 key square and every digraph step.Pwned Password CheckerCheck if a password appeared in data breaches; only 5 characters of its SHA-1 hash are sent.RSA Encryption ToolEncrypt text with an RSA public key and decrypt it with the private key using RSA-OAEP in your browser.SAML DecoderDecode SAMLRequest and SAMLResponse messages to readable XML, attributes and validity times.SSL Certificate ConverterConvert SSL certificates and keys between PEM, DER, PFX/P12 and P7B in your browser.Checksum CalculatorCompute 8-bit sum, two's complement LRC, XOR/BCC, NMEA, Fletcher and Internet checksums of bytes.PBKDF2 Hash GeneratorDerive PBKDF2 keys from a password, salt and iteration count with SHA-1, SHA-256 or SHA-512.Protobuf DecoderDecode raw Protocol Buffers hex or Base64 without a schema, or add a .proto for field names.XML Escape / UnescapeEscape & < > " ' for XML text and attributes, unescape entities back, or wrap text in CDATA.Binary Search Tree VisualizerInsert, delete and find in BST, AVL and red-black trees with animated rotations and traversals.MongoDB ObjectId to TimestampDecode a MongoDB ObjectId to its creation date, or build ObjectIds from dates for range queries.PGP Encrypt / DecryptEncrypt, decrypt, sign and verify PGP messages with your armored keys, entirely offline.PGP Key GeneratorGenerate an OpenPGP key pair (Curve25519, NIST ECC or RSA) with passphrase and expiry, offline.Quoted-Printable Encoder / DecoderEncode or decode quoted-printable email text (MIME) with UTF-8 and 76-character soft line breaks.SHA-1 Hash GeneratorSHA-1 and HMAC-SHA1 of text or files in hex or Base64, plus Git blob hashes and verify.SHA-512 Hash GeneratorSHA-512 and SHA-384 hashes of text or files in hex or Base64, HMAC and hash verification.SRI Hash GeneratorCreate Subresource Integrity hashes (sha256/384/512) and ready <script> or <link> tags.SSH Key GeneratorGenerate Ed25519 or RSA SSH key pairs in your browser: OpenSSH public key plus private key.
See all 65 Encoders, Hashes & Crypto →