Wildcard records
The short version
- A wildcard record has an asterisk (
*) as the first part of its name. - It answers for any name under it that has no record of its own.
- A record that does exist always wins over the wildcard.
- The asterisk only works as the first part of a name.
What a wildcard is
Most records name one exact place. An A record for shop.example.com answers for shop.example.com and nothing else.
A wildcard works differently. You write a record whose name starts with *. At most DNS hosts, you do that by typing an asterisk in the Name field.[1]
*.example.com. 3600 IN A 192.0.2.1
Now a lookup for shop.example.com gets 192.0.2.1. So does blog.example.com, and so does any other name you never set up. This is handy when you have lots of subdomains that all go to the same place. You don't need one record for each.
Exact records win
A wildcard is a fallback. It is only used when nothing else matches. Cloudflare's docs put it plainly: a wildcard applies only when no exact record exists at the queried name.[1]
Say you also add this record:
www.example.com. 3600 IN A 192.0.2.10
Then www.example.com gets 192.0.2.10. The wildcard is skipped for it. Every other name still gets 192.0.2.1. The standard's own examples show the same thing: a name that exists is not answered from the wildcard.[2]
This is why a wildcard doesn't break your other records. Your website, your email and your verification records keep working. See the A record and MX record chapters for those.
Where the asterisk can go
The asterisk is only special as the first part of the name. The standard says that names starting with any other label are never wildcards.[2] Cloudflare's docs say the same: wildcards are only supported on the first label.[1]
So sub.*.example.com is not a wildcard. The asterisk there is just a star character in a name.[1]
A wildcard also reaches down more than one level. A record for *.example.com covers abc.example.com and also 123.abc.example.com.[1] It does not cover example.com itself. That bare name has no part to fill the asterisk's place, so give it its own record.
Things to keep in mind
- A wildcard hides typos. Because every name gets an answer, a mistyped subdomain still "works". Visitors land on your server instead of seeing an error.
- Your host may not allow it. Cloudflare's docs say that wildcard custom domains aren't supported for a project on Cloudflare Pages.[1] Check your own host's instructions before you add one.
- The rules were tidied up once. RFC 4592 updated the wildcard wording of the original standard, RFC 1034.[2] So test the names you care about. The last chapter shows how to check.
Next: putting it to use
If you want subdomains to point somewhere, a wildcard is one way. The CNAME chapter covers the other: one alias per name.
Sources
- Wildcard DNS records, Cloudflare DNS docs (accessed 2026-10-23)
- RFC 4592: The Role of Wildcards in the Domain Name System, IETF (accessed 2026-10-23)