openssl is not recognized, see Add to PATH. You will also need an RSA or ECDSA private key — see Generate RSA key.One-step: generate key + CSR together
This creates a new 2048-bit RSA key and a CSR in a single command — the fastest approach for most use cases:
This produces two files: private.key (keep this secret) and request.csr (submit to your CA).
Two-step: existing key + new CSR
If you already have a private key, generate only the CSR from it:
Generate CSR without prompts (scripts / CI)
Use the -subj flag to pass all subject fields on the command line. Useful for automation:
In PowerShell, replace ^ with a backtick ` for line continuation.
CSR with SAN extensions
Modern browsers require Subject Alternative Names (SAN). Generate a CSR with SANs using a config file:
First create san.cnf in your working directory:
Then generate the CSR:
Inspect the CSR before submitting
Always verify the CSR contents before sending it to a CA:
CSR questions
What is the Common Name field?
example.com. For wildcard certificates, use *.example.com. Modern certificates rely on SAN extensions for domain validation, but the CN is still required.Do I need to keep the private key secret?
private.key) must never be shared. Only the CSR (request.csr) is sent to the CA. Anyone with your private key can impersonate your server.What file do I send to the CA?
request.csr file to your CA. The CSR contains your public key and subject information — no private key material. The CA will return a signed certificate.Can I reuse an existing private key for a new CSR?
openssl req -new -key existing.key -out new.csr. Many organizations reuse keys when renewing certificates, though generating a new key with each renewal is better security practice.Ready to create a self-signed certificate?
Use your key and CSR to generate a self-signed cert for dev/testing.
Related guides