Create .NET HTTPS Certificate for Local Development

Published: November 2, 2025

← Back to Home

When using the .NET SDK to work on a .NET web app (API, Blazor, etc.) in Visual Studio, the first time you start the application it will prompt you to trust the development certificate. If you’re running your app from the command line (or using a different editor), you can create and trust the same development certificate from the command line.

Run the commands below anywhere on your local development machine to create a certificate that enables HTTPS for localhost. By default the certificate is created in the current user’s certificate store and can be used for localhost endpoints on that machine. The behavior of the --trust option varies by OS (see notes below).

Create and trust the dotnet dev certificate:

dotnet dev-certs https --trust

If you want, delete/clean the dev certificate:

dotnet dev-certs https --clean

Platform notes and important warnings:

See Microsoft’s documentation on development certificates: Documentation from Microsoft

Keep it real!