ScriptsApr 13, 2026·3 min read

mkcert — Zero-Config Local HTTPS Development Certificates

mkcert is a simple tool that creates locally-trusted development certificates with zero configuration. No more browser security warnings in local development — just run mkcert and get valid HTTPS for localhost and any custom domain.

TL;DR
mkcert generates locally-trusted TLS certificates for development with a single command, no configuration needed.
§01

What it is

mkcert is a simple CLI tool that creates locally-trusted development certificates with zero configuration. It installs a local Certificate Authority in your system trust store, then generates certificates that browsers accept without warnings.

mkcert targets web developers who need HTTPS in local development for testing service workers, secure cookies, mixed content, or OAuth callbacks. It eliminates the pain of self-signed certificates and manual trust store management.

The project is actively maintained and suitable for both individual developers and teams looking to integrate it into their existing toolchain. Documentation and community support are available for onboarding.

§02

How it saves time or tokens

Without mkcert, setting up local HTTPS involves generating a CA, creating certificates, adding the CA to multiple trust stores, and repeating this on each machine. mkcert does all of this with mkcert -install followed by mkcert localhost. No OpenSSL commands, no manual trust store edits, no browser restarts.

§03

How to use

  1. Install mkcert via Homebrew (brew install mkcert), Chocolatey, or download from GitHub releases.
  2. Run mkcert -install once to create and install the local CA.
  3. Run mkcert localhost 127.0.0.1 ::1 to generate certificate and key files.
  4. Configure your dev server (Vite, webpack-dev-server, nginx) to use the generated .pem files.
§04

Example

# Install mkcert and set up the local CA
brew install mkcert
mkcert -install

# Generate certificates for local development
mkcert localhost 127.0.0.1 ::1 myapp.local
# Creates: localhost+3.pem and localhost+3-key.pem

# Use with Node.js
node -e "
const https = require('https');
const fs = require('fs');
https.createServer({
  key: fs.readFileSync('localhost+3-key.pem'),
  cert: fs.readFileSync('localhost+3.pem')
}, (req, res) => res.end('Hello HTTPS')).listen(443);
"
§05

Related on TokRepo

§06

Common pitfalls

  • Sharing mkcert-generated certificates across machines. The CA is local to your machine. Certificates will not be trusted on other machines unless you export and install the CA there.
  • Using mkcert certificates in production. They are signed by a local CA that public browsers do not trust. Use Let's Encrypt or a commercial CA for production.
  • Forgetting to run mkcert -install first. Without installing the local CA, generated certificates trigger the same browser warnings as self-signed certs.
  • Not reading the changelog before upgrading. Breaking changes between versions can cause unexpected failures in production. Pin your version and review release notes.

Frequently Asked Questions

Is mkcert safe to use?+

Yes, for development. mkcert creates a local CA that only your machine trusts. The CA private key stays on your disk. Do not share the CA key file, as anyone with it could generate certificates your machine would trust.

Does mkcert work on all operating systems?+

Yes. mkcert supports macOS, Linux, and Windows. It handles trust store installation for each platform automatically, including Firefox's separate certificate store via NSS.

Can I use mkcert with Docker?+

Yes. Mount the generated certificate files into your Docker container. For the container to trust the CA, you also need to mount the CA cert and run update-ca-certificates inside the container.

How is mkcert different from self-signed certificates?+

Self-signed certificates are not trusted by browsers and produce security warnings. mkcert installs a CA in your system trust store, so certificates it signs are trusted by all browsers on your machine without warnings.

Does mkcert support wildcard certificates?+

Yes. Run `mkcert '*.myapp.local'` to generate a wildcard certificate. This is useful when your local development environment uses multiple subdomains.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets