Advertising disclosure: We may earn a commission from links on this site. Commercial relationships can affect placement. Product facts, limitations, and source dates remain part of our editorial record.

How funding works
Web Hosting

Cloudflare Wildcard DNS records: A Guide for Website Owners

Learn how Cloudflare wildcard DNS records route unmatched subdomains, how exact records take precedence, and what to check before enabling one.

Review sources
Research standard

Facts that can change should include a source and check date. Benchmark claims should state the plan, region, method, and test period.

Wildcard DNS records are useful when many subdomains should resolve to the same destination. In Cloudflare, add a DNS record whose Name is *; the wildcard then acts as a catch-all for subdomains that do not have an exact DNS record. For *.www.example.com, Cloudflare says to enter *.www in the Name field. This behavior and setup apply to Cloudflare DNS, so confirm equivalent rules before using a different provider.

How wildcard matching works#

A wildcard does not replace every DNS record in a zone. Specific DNS records and delegations take precedence. If blog.example.com has its own record, that exact record is used instead of the wildcard.

Cloudflare supports wildcards only in the first label. In subdomain.*.example.com, the asterisk is treated as a literal character rather than a wildcard. Cloudflare also states that *.example.com can cover deeper subdomains when no more-specific record takes precedence.

Data table from this page
Hostname or patternWhat happens
store.example.comThe wildcard can answer if no exact or more-specific record exists.
blog.example.comAn exact record for blog takes precedence.
subdomain.*.example.comThe asterisk is literal because it is not the first label.

Add a wildcard record in Cloudflare#

  1. Open the DNS records for the relevant domain in Cloudflare.
  2. Add a record and choose the type that matches the destination. Cloudflare documents wildcard examples using both A and CNAME records.
  3. Enter * in the Name field for a wildcard such as *.example.com. For *.www.example.com, enter *.www.
  4. Enter the destination for the record.
  5. Set the record to proxied or DNS-only as appropriate. Cloudflare allows wildcard records in either state.
  6. Review existing records and delegations before saving so that intended exceptions remain explicit.

The wildcard is most useful when otherwise-unmatched subdomains should use the same destination. If different subdomains need different destinations, create specific records for those names; those records take precedence over the wildcard.

Check HTTPS separately#

DNS routing and HTTPS certificate coverage are separate concerns. A wildcard record can direct a hostname to a destination, but it does not by itself ensure that visitors will receive a certificate covering that hostname.

Cloudflare notes that, with its partial CNAME setup, SSL/TLS certificates are not automatically provisioned for wildcard records. Certificate validation and renewal still need to be handled for the hostnames visitors will use. Before enabling the record, check that the planned certificate coverage matches the wildcard and any deeper subdomains that may receive traffic.

Cloudflare also warns that wildcard custom domains are not supported for Cloudflare Pages. If the destination is a Pages project, review that limitation before creating the record.

For the provider-specific rules and examples, see Cloudflare: Wildcard DNS records and the Cloudflare DNS documentation.

Sources

  1. Cloudflare: Wildcard DNS records Checked 2026-11-01
  2. Cloudflare DNS documentation Checked 2026-11-01