---
title: "How to Set Up Netlify DNS - Custom Domains, CNAME, & Records"
description: "Learn how to set up DNS on Netlify. Should you choose a subdomain or bare domain? Use Netlify DNS or another DNS provider? See our recommendations to help you best leverage our global CDN."
source: "https://www.netlify.com/blog/2020/03/26/how-to-set-up-netlify-dns-custom-domains-cname-and-a-records/"
last_updated: "2026-07-09T02:59:35.000Z"
---
You’ve [created a Netlify account](https://app.netlify.com/signup) to host your website, chosen your preferred deployment method, and now you want to configure your custom domain name. How you configure your domain name impacts both how people will find your site, but also what kind of site performance they will experience when they visit. In this article, based on a 2017 post by Mathias Biilmann, we’ll dive into what we currently recommend and why.

A quick note before we get started: when we talk about [Netlify DNS](https://docs.netlify.com/domains-https/netlify-dns/), we’re referring to our service for hosting your DNS together with your website; Netlify DNS doesn’t work with sites hosted elsewhere.

Now that that’s out of the way, it’s helpful to think of the different ways you can configure your primary domain as falling into one of these categories:

-   Bare domain (no subdomain) on Netlify DNS
-   Subdomain, on Netlify DNS
-   Bare domain (no subdomain) on another DNS provider
-   Subdomain, on another DNS provider

Using a [custom domain with Netlify DNS](https://docs.netlify.com/domains-https/custom-domains/), as a bare domain or with a subdomain, is the most straightforward. It doesn’t matter whether your primary domain is `example.com` or `www.example.com`; Netlify DNS makes either DNS configuration possible and performant in just a few clicks.

But if you’re not using Netlify DNS, deciding whether to use a subdomain or a bare domain matters a lot and which one you choose significantly affects whether your site will benefit from our CDN.

## Point your subdomain to Netlify with a CNAME

DNS stands for “domain name system” and it’s the internet-wide phone book that tells browsers how to resolve a human-readable name (like [netlify.com](https://www.netlify.com/)) to an IP address of a server (like 75.2.60.5) that the browser can open a connection to.

There are two kinds of DNS records relevant to hosting a website with Netlify:

-   **A record** Apex, or root, record; maps a [hostname](https://superuser.com/questions/887173/what-is-a-hostname-versus-a-computer-name-versus-a-subdomain-versus-www) to an IPv4 address of a server.
-   **CNAME record** Canonical name record used to specify an alias; maps one human-readable hostname to another one that the browser should look up instead.

When you configure a custom domain to point to a Netlify site, we recommend setting up your primary site as a subdomain that uses the `www.` prefix (or `app.` or `docs.`, etc.) and a CNAME mapping that site to the URL of your Netlify site, `<automatically-generated-name>.netlify.app` (where `<automatically-generated-name>` depends on the name of your Netlify site in the Netlify UI). If you go this route, here’s what will happen when a user visits your site:

1.  The browser will look up the DNS record for `www.example.com`
2.  Then, it will hit the CNAME record you set up telling it to look up `<automatically-generated-name>.netlify.app` instead
3.  Then, when it looks up `<automatically-generated-name>.netlify.app`, it will hit a CNAME record that we’ve set up internally that’s configured to use our CDN and deliver all of its performance benefits to your site’s visitors

What’s great about this configuration is that if someone is visiting your site and our system has detected that our main load balancer is slow or unresponsive because, for example, it’s currently being hit by a large DDoS attack, we’ll simply route around that slowness on the network level. We also use advanced traffic direction to serve your site from the node that’s geographically closest to the person visiting. TL;DR: Visitors experience extremely fast page load times regardless of where they are located or what’s happening elsewhere on the network.

## An A record on your bare domain

So you move forward with our recommended setup and your site lives at `www.example.com` instead of `example.com`. You’ll still want a way to point your bare domain—`example.com`—at our load balancer. That way, when someone visits `example.com` without the `www.`, they’ll still see your site.

You might think that you could simply configure a CNAME record for the apex domain—point `example.com` to `<automatically-generated-name>.netlify.app`—but you shouldn’t! This could severely break other things for you. According to the DNS specification, any domain name that has a CNAME record set cannot have any other DNS records associated with it. This means that if you set up a CNAME record for `example.com`, you wouldn’t be able to set up MX records—so you wouldn’t be able to receive email at that domain. Want to validate your domain for Google’s webmaster tools? Or perhaps you’d like to use the SPF system to help verify your email sending hosts? You’d need to add a TXT record to the apex domain, but you wouldn’t be allowed to because you already have a CNAME.

The only remaining option is an A record. We publish the static IP address of our main load balancer so you can associate it with your A record. (Note that you should use this published address instead of grabbing an IP address that happens to be associated with your subdomain on a given day. Why? Because the IP addresses that CNAME records point to change all the time, depending on what nodes are available on our CDN.) With the A record in place on `example.com`, we’ll be able to serve an HTTP 301 redirect from there to `www.example.com`, which points to `<automatically-generated-name>.netlify.app` where your site assets actually live.

There’s one small but unavoidable downside here: manually setting an A record on your apex domain that points to our load balancer doesn’t let us insert any advanced traffic direction. We have no way of routing users who go to `example.com` (without the `www.`) to the closest or most performant CDN node. Luckily, any suboptimal performance will only affect site visitors the first time they go to the bare domain; after that, their browser cache will have the redirect to `www.example.com`, where they’ll benefit from our globally distributed infrastructure.

## Options for bare domains

Some might think that the decision of whether or not to use the `www.` prefix is merely cosmetic; there are whole websites arguing against the `www.` prefix. However, dropping `www.` from your main site domain can have dire consequences because of how DNS records work.

So what are your options if you absolutely must have your site at `example.com` instead of `www.example.com`? Our recommendations in this case are to use [Netlify DNS](https://docs.netlify.com/domains-https/netlify-dns) with the bare domain or use [Cloudflare’s CNAME flattening](https://www.cloudflare.com/dns/). It’s also possible to configure a performant bare domain if [NS1](https://ns1.com/) is your DNS provider. Please [reach out to our Support team](https://www.netlify.com/support/) if you’d like to set this up using NS1. Outside of these three options, we do not recommend using a bare domain as your primary domain.

## Ideal Netlify DNS setup

Ultimately, we suggest using a subdomain—`www.` or any other subdomain like `app.` or `docs.`—as your primary domain. This way, you’ll get the full benefit of our advanced traffic direction on your main site, while preserving the ability to use MX, TXT, and other records on your apex domain. If you use [our own DNS hosting](https://docs.netlify.com/domains-https/netlify-dns/), we automatically create the DNS records you need to give your site great performance. And if you need your bare domain to be your primary one, Netlify DNS makes that happen automatically.

Feel free to drop [into the forum](https://community.netlify.com/c/connect/) with any questions or comments about setting this up yourself!

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=How to Set Up Netlify DNS - Custom Domains, CNAME, & A Records&url=https://www.netlify.com/blog/2020/03/26/how-to-set-up-netlify-dns-custom-domains-cname-and-a-records//)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2F2020%2F03%2F26%2Fhow-to-set-up-netlify-dns-custom-domains-cname-and-a-records%2F%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/2020/03/26/how-to-set-up-netlify-dns-custom-domains-cname-and-a-records//)
-   [Bluesky](https://bsky.app/intent/compose?text=How to Set Up Netlify DNS - Custom Domains, CNAME, & A Records+https://www.netlify.com/blog/2020/03/26/how-to-set-up-netlify-dns-custom-domains-cname-and-a-records//)

* * *

### Tags

-   [DNS](/blog/tags/dns/)
-   [Netlify](/blog/tags/netlify/)
-   [how-to](/blog/tags/how-to/)

## Keep reading

![](/images/blog-fallback-thumbnail.svg)

Guides & Tutorials July 7, 2020

[

### What is DNS and How Domains Work on Netlify

](/blog/2020/07/07/what-is-dns-and-how-domains-work-on-netlify/)

-   ![Profile picture of Jared Ewy](/_astro/fa8022817e27b99021d8c59b914ea767aedfc186-80x80_2wP8Az.webp)
    
    Jared Ewy
    
-   ![Profile picture of Sarfaraz Rydhan](/_astro/7b68d8ea2e92f9dfe4fef2fad3e642000b2445f7-328x328_ZQn9ng.webp)
    
    Sarfaraz Rydhan
    

![](/_astro/cfdc437592ee2bf75a62690af707d52533d08063-1600x900_2njoni.webp)

Opinions & Insights May 14, 2026

[

### How we built Netlify Database for AI-native development

](/blog/how-we-built-netlify-database-for-ai-native-development)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

## Recent posts

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

News & Announcements June 24, 2026

[

### How we measure Netlify’s Agent Experience

](/blog/how-we-measure-netlify-agent-experience)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

Guides & Tutorials May 15, 2026

[

### How to build a real-time AI chatbot in minutes with Netlify Agent Runners (no backend)

](/blog/how-to-build-a-real-time-ai-chatbot-in-minutes-with-netlify-agent-runners-no-backend)

-   ![Profile picture of Nahrin Jalal](/_astro/f0e7c8f227a03fe58340c99ef5439d5a896c0733-272x272_Z23kDpD.webp)
    
    Nahrin Jalal
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)