What is Wildcard DNS?
A wildcard DNS record, written as *.example.com, answers DNS queries for any nonexistent subdomain of a parent domain with a single configured result.
A wildcard DNS record is a resource record in a DNS zone that matches all query names where the corresponding owner name does not exist in the zone. It is written as an asterisk followed by a dot, then the domain name, for example *.example.com. The wildcard matches any name at its own level in the hierarchy, but it does not match the parent domain itself or names that already have an explicit record.
When a DNS resolver queries a name like random.example.com and no A, AAAA, or other record exists for that exact name, the authoritative server checks for a wildcard record at the *.example.com level. If found, it returns the record defined for the wildcard (often an A record pointing to a web server or an MX record for catch-all email). The wildcard expansion does not apply to the root of the zone (example.com) or to names that are already defined, nor does it match deeper levels if the intermediate name exists. For example, *.example.com will match foo.example.com but not bar.foo.example.com unless there is no foo.example.com record.
Wildcard DNS is commonly used for hosting providers that assign dynamic subdomains to users, or for redirecting all undefined subdomains to a single website. It is defined in RFC 1034 section 4.3.3 and further clarified in RFC 4592. The wildcard does not apply to all record types uniformly; it synthesizes a response only for the query type that the wildcard record itself defines. Operators must be careful not to create conflicting records that break expected behavior, such as blanking a zone with an unintended wildcard MX record in mail environments.
Key facts
- Written as *.example.com, matching any nonexistent subdomain at that level.
- Does not match the naked domain (example.com) itself.
- Only synthesizes responses for the record type of the wildcard record.
- Defined in RFC 1034 section 4.3.3, clarified by RFC 4592.
- Commonly used for catch-all websites or dynamic subdomain provisioning.
How it works in practice
Related terms
References
More in DNS
A Record
A DNS resource record that maps a hostname to a 32-bit IPv4 address. It is the most fundamental record type for translating domain names to numeric addresses on the Internet.
AAAA Record
A DNS resource record that maps a hostname to a 128-bit IPv6 address, analogous to the A record for IPv4.
Authoritative DNS
An authoritative DNS server holds the definitive resource records for a specific domain and responds to queries with the final answer for that zone, not a cached copy.
CAA Record
A CAA (Certification Authority Authorization) DNS record lets domain owners specify which certificate authorities are permitted to issue SSL/TLS certificates for their domain.
CNAME Record
A DNS record that maps an alias hostname to the true or canonical hostname, allowing multiple names to resolve to the same IP address without duplicating A or AAAA records.
DNS
The Domain Name System (DNS) is a hierarchical, distributed naming system that translates human-readable domain names (like example.com) into IP addresses and other resource records used by internet protocols.
DNS Anycast
DNS Anycast uses one IP address served from multiple geographically distributed nameservers; queries are routed to the nearest or healthiest node, improving resilience and reducing latency.
DNS Caching
DNS caching stores resolved domain name query results for the specified TTL duration to avoid repeated queries to upstream authoritative servers.
DNS Hijacking
DNS hijacking is an attack or misconfiguration that returns forged DNS responses, causing users to connect to attacker-controlled hosts instead of the intended server.
DNSSEC
DNSSEC (DNS Security Extensions) add cryptographic digital signatures to DNS records, enabling resolvers to verify that responses have not been tampered with or spoofed.