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.
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.
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.
How to use
- Install mkcert via Homebrew (
brew install mkcert), Chocolatey, or download from GitHub releases. - Run
mkcert -installonce to create and install the local CA. - Run
mkcert localhost 127.0.0.1 ::1to generate certificate and key files. - Configure your dev server (Vite, webpack-dev-server, nginx) to use the generated
.pemfiles.
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);
"
Related on TokRepo
- AI Tools for Coding — Development tools and local environment setup utilities.
- AI Tools for Security — Security tools including certificate management and TLS configuration.
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 -installfirst. 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
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.
Yes. mkcert supports macOS, Linux, and Windows. It handles trust store installation for each platform automatically, including Firefox's separate certificate store via NSS.
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.
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.
Yes. Run `mkcert '*.myapp.local'` to generate a wildcard certificate. This is useful when your local development environment uses multiple subdomains.
Citations (3)
- mkcert GitHub— Zero-config locally-trusted development certificates
- mkcert README— Automatic trust store installation for all platforms
- Mozilla Server Side TLS— TLS certificate best practices
Related on TokRepo
Discussion
Related Assets
doctest — The Fastest Feature-Rich C++ Testing Framework
doctest is a single-header C++ testing framework designed for minimal compile-time overhead and maximum speed.
Chai — BDD/TDD Assertion Library for Node.js
Chai is a flexible assertion library for Node.js and browsers that supports expect, should, and assert styles.
Supertest — HTTP Assertion Library for Node.js APIs
Supertest provides a high-level API for testing HTTP servers in Node.js with fluent assertion chaining.