× press ESC to close

Netlify builds, deploys, and hosts your front end.

Using a custom domain

You can use your own domain for a Netlify site for free.

While we can host any hostname(s) for you, these instructions are generally tailored to people hosting their main domain/website here in the pattern example.com + www.example.com. If you have other goals, please make sure you read this section at the end of the doc.

Assigning the domain

First, you need to assign the domain to the site you want us to show for that name.

You can do this through the web UI by clicking “Domain settings” when viewing your site dashboard.

custom-domain

You can also assign domains through the CLI tool with the netlify update command.

We highly recommend setting your custom domain to a www hostname instead of an apex domain (ie. www.example.com instead of example.com). Unless your DNS provider supports ANAME or ALIAS records for the apex domain you won’t be able to take full advantage of our CDN unless you use the www prefix or another subdomain. This article has more details on why we recommend that.

DNS configuration

You’ll need to point the DNS records for the domain at our servers.

The recommended way to point your custom domain to our servers is by creating a CNAME record in your DNS configuration. This record will be an alias to your site’s subdomain on Netlify. For instance, if my domain is example.com and my netlify sitename is example, I would create a CNAME record for www pointing www.example.com to example.netlify.com.

Note that no matter which setup you pick for Netlify - you’ll want to set up BOTH records at your DNS provider (bare domain and www), so that people who type either one in can end up at your website, and so that our automatic domain redirects work.

There are two options if you want to serve your website from a naked domain, without the www.

  1. Recommended: Use a DNS provider that supports ANAME or ALIAS records for apex domains, and alias your naked domain to <your-site-name>.netlify.com. We recommend using NS1 for this purpose.
  2. Alternative: Create an A record pointing your naked domain to our load balancer’s IP: 104.198.14.52.

Example of DNS configuration in Goddady's DNS record panel

Depending on your DNS provider, changes to DNS records can take several hours to propagate and take effect for the entire internet.

Netlify DNS

Netlify offers the option to handle DNS management for you. This enables advanced subdomain automation and deployment features, and ensures that your site uses our CDN for the bare domain as well as subdomains like www.

Step 1: After setting up a custom domain on the domain settings page, click the button allowing us to manage your domain needs.

domain-walkthrough

Step 2: Once you have set up a custom domain and enabled Netlify DNS, you need to switch your domain host’s nameservers to our custom NS1 name servers, which we provide in the instructions section of the domain panel. If you don’t see the list at first, you might need to click the ‘show details’ button to show the list.

domain-instructions

The process for changing your domain’s nameservers varies from registrar to registrar. For your convenience, we’ve gathered links to instructions for popular registrars Hover and GoDaddy.

Domain Records

* Only available with Netlify DNS

The Domain Record form allows you add any standard record type with custom values, TTL, and priority. Remember, it may take up to a few hours for record changes to propagate.

dns-records

Branch Subdomains

* Only available via our UI with Netlify DNS

Netlify DNS can automatically turn your deployed branches into their own subdomains.

For example: If you have a branch named staging, you can view it at staging.example.com. Use the “New subdomain” button to select a branch and create a subdomain for that branch.

subdomain

A subdomain can be deleted by clicking the x button in the corresponding subdomain row.

subdomain-record

If you need to set up branch subdomains without us managing your DNS, please contact support.

Naked domains?

You can use Naked domains with Netlify, but we recommend you always use the www version of the domain (eg. www.example.com) for your site. This makes it easier to take advantage of Netlify’s powerful CDN.

If you prefer the naked domain, we recommend you use a DNS provider that supports ANAME or ALIAS records for apex domains such as DNS Made Easy or NS1.

If you instead set an A record for the apex domain, you won’t be able to take advantage of the full Netlify CDN. If your provider lets you set an ALIAS, the full CDN will work. If not, when you serve from your apex domain with an A record, your assets (Javascript, CSS, images) may be served out of a global CDN depending on your deployment settings, but your HTML will be served out of our primary datacenter in the US.

Domain redirects

We’ll automatically set up redirects for the alternative domain to the primary domain. So if you use www.example.com, we’ll configure example.com to do a 301 redirect to the www domain. If you assign the naked domain to your site, we’ll redirect in the opposite direction.

We only redirect automatically between the root domain and www. Not any other subdomains. You can configure other hostname redirection yourself as described in this article.

Domain aliases

You can setup domain aliases for your domain, so the same site will be rendered on several different domains. You can use domain aliases together with rewrite and redirect rules to redirect or rewrite based on the hostname entered into the browser by your visitors.

Alternate Domain

If you are planning to set your site’s custom domain to a subdomain, like sub.yourdomain.com, most of the above instructions won’t be as applicable to you. The things to make sure of are:

  1. You should use a CNAME DNS record for that subdomain to point to your sitename.netlify.com so you can use the CDN.
  2. You don’t need a www.subdomain.yourdomain.com DNS entry.
  3. You probably want to stick with your external DNS host. If you use Netlify DNS, you’ll be hosting yourdomain.com with us, not subdomain.yourdomain.com. Netlify DNS can only manage entire DNS zones for top level domains.

Notice something is incorrect or outdated?

First off, great eye! We appreciate your discovery and want to ensure it gets addressed immediately. Please let us know here.

Want to get started quick?