Glossary / DNS records

Wildcard DNS record

A wildcard DNS record is a record whose name starts with an asterisk, such as *.example.com, that answers for any subdomain without a record of its own. A lookup for anything.example.com returns the wildcard's value. Names that already exist, even with other record types, are not covered.

Copy the syntax

Wildcard A record

*.example.com. 3600 IN A 192.0.2.40

Any undefined subdomain resolves to this address.

Wildcard CNAME

*.example.com. 3600 IN CNAME app.example.net.

Common for multi-tenant apps where each customer gets a subdomain.

Have a name in mind?

.com $24.99 first year, renews at $24.99/yr. Other endings: not on sale yet.

In plain English

A wildcard record catches every subdomain you did not set up, and sends it to one place.

What to do

  • Use it for apps that give each customer a subdomain.
  • Pair it with a wildcard certificate.
  • Add explicit records for names that need something different.
When a wildcard answersLookup for acme.example.com finds no record, matches *.example.com, and returns the wildcard address.1 · Askacme.example.comno record exists2 · Wildcard*.example.commatches3 · AnswerA 192.0.2.40synthesized reply
The server synthesizes an answer from the wildcard only when no record exists for the exact name.
Defined in
RFC 4592 (updates RFC 1034, section 4.3.3)Source: RFC 4592
Asterisk position
Leftmost label onlySource: RFC 4592
Works with
Most types, including A, AAAA, CNAME, MX, TXTSource: RFC 4592
What is a wildcard DNS record used for?

Apps that give every customer a subdomain use wildcards so new names work instantly. Teams also use them for preview environments and catch-all landing pages.

Pair the record with a wildcard SSL certificate, or every new subdomain will show a certificate warning.

What does a wildcard not match?

A wildcard never overrides a name that exists. If shop.example.com has a TXT record only, a lookup for its A record returns nothing rather than the wildcard. It also does not match the bare domain.

Wildcard behavior, case by case

Zone has *.example.com A 192.0.2.40 and www.example.com A 192.0.2.10 (RFC 5737 addresses).
QueryResultWhy
anything.example.com A192.0.2.40No exact record, wildcard matches
www.example.com A192.0.2.10Exact record wins
a.b.example.com A192.0.2.40Wildcard matches deeper names if no closer node exists
example.com ANot from wildcardThe bare domain is not a subdomain

Test a made-up name

dig random-name.example.com +short

Should return the wildcard's value.

Questions about Wildcard DNS record

Can I have a wildcard CNAME?

Yes. *.example.com can be a CNAME to another hostname. The same rule applies as for any CNAME: the wildcard name cannot also hold other record types.

Do wildcard records work for email?

They can, but be careful. A wildcard MX makes every made-up subdomain accept mail routing, which spammers can abuse. Most domains are better off with explicit MX records only.

Does a wildcard DNS record need a wildcard certificate?

For HTTPS on arbitrary subdomains, yes, or a certificate issued per subdomain on demand. Without one, visitors see a name mismatch warning.

Why does my wildcard not work for one subdomain?

That subdomain probably has some other record already, such as a TXT for verification. Any existing record at a name blocks the wildcard there. Add the A or CNAME at that name directly.

Put it to work on your own domain

See the first-year and renewal price before you pay.

.com first year$24.99, renews $24.99Check a domain
↑