Certificate name mismatch: which names a TLS certificate covers

By TechCompare · Updated · How we check

A certificate only covers the names in its Subject Alternative Name list. A wildcard like *.example.com covers one level of subdomains, not example.com itself and not a.b.example.com.

A TLS certificate lists the host names it's valid for, and the browser checks that the name in the address bar is one of them. When it isn't, the browser shows a name mismatch error, like NET::ERR_CERT_COMMON_NAME_INVALID in Chrome, and stops the visitor. The certificate can be valid, trusted and current, and still be the wrong one for that name.

Topic
Name mismatch
Certificate names
Category
TLS and certificates
Versions, keys and certificate errors

How this is calculated

Browsers only read the Subject Alternative Name (SAN) field. The old Common Name field is still in most certificates, but Chrome stopped using it to match names in 2017, and other browsers did the same. One certificate can list many names, so a domain and its subdomains often share one.

Wildcards match exactly one label. *.example.com covers www.example.com and shop.example.com. It doesn't cover example.com, and it doesn't cover dev.shop.example.com. That's why most certificates list example.com together with *.example.com or www.example.com.

The usual causes are a missing www name, a subdomain added after the certificate was issued, and a server handing out its default certificate. That last one happens when several sites share an IP address and the server finds no match for the name the browser sent in its hello, a field called SNI. A CDN that hasn't finished setting up a custom domain looks the same from outside.

The SSL Checker lists the names on the certificate the server sent for the host you entered, and flags a mismatch when that host isn't covered.

Verdict

Get certificates for every name visitors can reach, which usually means the bare domain and www together. Add a new subdomain to the certificate before pointing DNS at it, or use a wildcard. Then check each name on its own, since a server can send a different certificate for each host.

More SSL scenarios

Frequently asked questions

Does a certificate for example.com cover www.example.com?
Only if www.example.com is also in its name list. They're different names. Most CAs and ACME clients make it easy to add both, so ask for both.
Can a certificate cover an IP address?
Yes, but only when the address is listed in the certificate as an IP address entry, and few sites have one. Visiting a site by its IP address usually shows a name mismatch, because its certificate lists domain names.
Why do I see a mismatch only on some networks?
Some networks and security products inspect HTTPS by swapping in their own certificate. If that certificate doesn't list the site, or your device doesn't trust the product's CA, you see an error there and nowhere else.