Skip to content
4 min read

Working with DNS

Learn how DNS works in order to properly configure your domain.
Table of Contents
Choose a framework to optimize documentation to:

    DNS is the system used to connect domain names to IP addresses. When you make a request for a website, the browser performs a DNS query. It's usually the recursive resolver that carries out this work, going to the root DNS nameserver, TLD nameserver, and the authoritative server, if it isn't found in the cache.

    DNS configuration with multiple DNS record types

    There are a number of different types of DNS records that can be used together to create a DNS configuration. Some of the common information that you might see in a DNS record are:

    • Host Name: The hostname of www
    • IP Address or URL: The IP address (or domain or in the case of a CNAME record), for example, 76.76.21.21 or vercel.com.
    • TTL (Time to live): The length of time the recursive server should keep a particular record in its cache. You should set this time based on how often people are visiting your site and how often your site may change. For more information, see the DNS propagation section.
    • Record Type: For example, CNAME. There are many different types of records, some of the most common are listed below.

    To learn more about adding, verifying, and removing DNS records, see "Managing DNS records".

    Type
    Name
    Use
    A
    Address
    This is used to translate apex domains into IPv4 addresses.
    AAAA
    Quad Address
    Similar to A, it is used to translate apex domains into IPv6 addresses. AAAA records are not supported on Vercel. See IPv6 support for more information.
    CNAME
    Canonical Name
    This is often used by subdomains, particularly for the www subdomain that points to your apex domain. CNAME records allow you to give multiple names to a single site, but each of these should all point to an A name record
    MX
    Mail eXchange
    This is used to specify the mail server that will handle incoming emails on behalf of a domain name. Like CNAME records, they must map to an existing address record (A, AAAA). It cannot point to a CNAME record
    NS
    Nameserver
    This is used to specify the actual authoritative server for a particular domain during DNS routing
    TXT
    Text
    This is used to enter a string of text about a domain and is often used for domain verification purposes
    SRV
    Service
    This is used to specify information for services, such as a target and port

    When you're configuring or making changes to your DNS settings, you should be aware that it doesn't happen instantaneously. There's a whole network of servers, each of which has their own cache, and each of these will need to be updated to any new values that you set. For this reason, it can be normal to take up to 24-48 hours to see changes fully propagate through the network.

    As we described earlier, when you set a record, you normally set a TTL value, or Time to Live, on a DNS record. This value, set in seconds, is the length of time a DNS cache will store information about your site, before it requests a new copy of the record from the authoritative server.

    When you set the TTL value in your DNS record, you need to find the balance between serving your users the site quickly, and ensuring they're not seeing outdated information. A short TTL (minimum 30s) is beneficial if you are constantly updating the content, but will cause slower load times for your site. Using a longer TTL (max 86400 seconds, or 24 hours) means that records are cached for longer, so the site can load quickly for your users. Vercel defaults to 60s for a DNS record.

    When you are transferring an existing (in-use) domain to Vercel, it's a good practice to check the existing DNS record and its TTL before switching. Ideally, about 24 hours in advance of changes, you should shorten the DNS TTL to 60s. Once it's propagated, you can then change the DNS record to Vercel so that traffic quickly moves over to the new site because now the DNS TTL is much shorter.

    You can use tools such as https://www.whatsmydns.net to determine if your DNS settings have been fully propagated.

    To learn more about common DNS issues, see the troubleshooting doc.

    Last updated on September 23, 2023