designwithfocus

Domains, hosting & DNS

What Is an NS Record? The DNS Pointer to Name Servers

By Design With Focus Team 6 min read
A domain name arrow pointing at two name server boxes

Short answer

An NS record names the host that should be authoritative for a domain. RFC 1035 defines type NS as an authoritative name server. The record's data is a domain name, not an IP address. Cloudflare uses the same record to say which server should answer authoritative DNS. An A record stores an address, and an MX record names a mail exchange.

Last verified against the sources listed below.

Key takeaways

  • RFC 1035 type 2, NS, means an authoritative name server for the owner name.
  • The data is a host name. Resolvers still need an address record for that host.
  • An A record stores a 32-bit Internet address. An MX record names a mail exchange.
  • Cloudflare says you add NS rows for a subdomain setup or an outside delegation.
  • Keep a delegation at seven name servers or fewer. Cloudflare rejects more than 10.

A direct answer to what is an ns record starts with authority. The record names a host that should answer for a domain, instead of storing the website address itself.

RFC 1035 lists NS as type 2, “an authoritative name server.” The same section says the data field, called NSDNAME, is a domain name. That host should be authoritative for the specified class and domain.

What does the record point at?

The record points at a name server, not at a page or an inbox. Cloudflare’s DNS record types say an NS record indicates which server should be used for authoritative DNS.

RFC 1035 adds a second detail. NS records cause the usual extra lookup for a type A record, so the resolver can find an address for the named host. When the NS record is used in a referral, the server also looks in the zone for glue.

The NS record states that the named host should be expected to have a zone starting at the owner name. The class is often a hint about how to query that host. Hosts that serve Internet class data are normally queried with Internet class protocols.

How do NS, A, and MX differ?

They answer three different questions about a name. NS asks who is authoritative. A asks for an address. MX asks where mail should go.

Type RFC 1035 meaning What the data holds
NS, type 2 An authoritative name server A host name for that zone
A, type 1 A host address A 32-bit Internet address
MX, type 15 A mail exchange A preference plus a host name

An A record’s address in a master file is four decimal numbers separated by dots, with no spaces. Hosts with multiple addresses have multiple A records. A records do not cause extra section processing.

An MX record’s preference is a 16-bit integer. Lower values are preferred. The exchange field is a domain name of a host willing to act as a mail exchange. MX records cause a type A lookup for that host.

Cloudflare describes the same split in product language. A and AAAA records map a name to one or more IPv4 or IPv6 addresses. An MX record is required to deliver email to a mail server. NS stays the pointer to authoritative DNS.

Where does the record sit in DNS?

The record sits inside the Domain Name System, which is larger than any one type. MDN’s glossary calls DNS a hierarchical and decentralized naming system for Internet-connected resources.

Its best-known job is translating a name such as mozilla.org into a numeric IP address. MDN calls that mapping a DNS lookup. A reverse lookup goes the other way, from an address back to a name. An NS record is how resolvers learn which server to ask for the rest of the data.

RFC 1035 describes the resolver as starting with knowledge of at least one name server. The resolver asks that server and may receive the answer or a referral to another name server. The NS record is the referral’s pointer.

Web hosting is where the site files live after DNS has led a browser to an address. The NS record does not store those files. It names the servers that publish the zone.

When do you add one?

You add one when a name’s authority should move to a specific set of servers. Cloudflare says you only add NS records in the DNS table for a subdomain setup or when you delegate subdomains outside Cloudflare.

The nameservers assigned to the whole zone are managed elsewhere. Cloudflare says those assigned nameservers, custom nameservers, and their TTLs are controlled in dedicated sections on the DNS Records page.

If Cloudflare is the authoritative DNS, you also do not create the SOA record yourself. Cloudflare creates it when you start using its authoritative nameservers. SOA marks the start of a zone of authority in RFC 1035, and its MNAME field is the name server that was the original or primary source of the zone data.

What limit applies?

The limit is about how many name servers one delegation name should list. Cloudflare cites the DNS guidance in RFC 1912: a delegation should not include more than seven nameserver names for the same name.

Cloudflare’s own cap is higher, and the page states both numbers. It supports up to 10 NS records per delegation name. Best practice on that page is to keep the set at seven or fewer. Creating more than 10 for the same name is not supported, and those requests may be rejected or fail validation.

An example on the page delegates the name blog to a list of external hosts, from ns1 through ns10. That table is the maximum. Another NS row for blog would be refused.

How do mail records fit beside it?

Mail records answer a different question after the NS records have identified the zone. An MX record is the type that names the mail exchange.

An SPF record is the text policy that lists who may send mail for the domain.

Cloudflare groups MX with email authentication records and says an SPF record lists authorized IP addresses and domains that can send email on behalf of the domain. None of those rows replace the NS set. They are data the authoritative servers publish.

A hosted site can also show a small icon in the browser tab. The Favicon Generator builds that icon. The icon is a file on the host, not a DNS type. You still need the NS records, and then an address record, before a browser can ask that host for the icon.

Frequently asked questions

Does an NS record contain the website's IP address?

No. RFC 1035 says the NS data is a domain name of a host that should be authoritative for the class and domain. The record also triggers an extra lookup for a type A record for that host. An A record stores a 32-bit Internet address. Cloudflare describes A and AAAA records as the rows that map a name to IPv4 or IPv6 addresses.

How is an NS record different from an MX record?

They name different jobs. NS names a host expected to hold the zone. MX names a host willing to act as a mail exchange, plus a 16-bit preference where lower values are preferred. RFC 1035 assigns type 2 to NS and type 15 to MX. Cloudflare says an MX record is required to deliver email. An NS record does not choose where mail is delivered.

When do you add NS records at Cloudflare?

Cloudflare says you add NS records in the DNS table only for a subdomain setup or when you delegate subdomains outside Cloudflare. The nameservers assigned to the zone itself, including custom nameservers and their TTLs, are controlled in a separate section of the DNS Records page. If Cloudflare is already the authoritative DNS for the zone, you do not create an SOA record either. Cloudflare creates that record automatically.

How many name servers can one name have?

Cloudflare cites RFC 1912 for the rule that a delegation should not include more than seven nameserver names for the same name. Cloudflare supports up to 10 NS records per delegation name, and it says the best practice is seven or fewer. Creating more than 10 for the same name is not supported. Requests past that limit may be rejected or fail validation.

Is an NS record the same thing as DNS?

No. DNS is the whole naming system. MDN describes it as a hierarchical, decentralized system that maps human-friendly names to resources such as IP addresses. An NS record is one record type inside that system. It tells a resolver which host should be authoritative for a name. Other types, including A and MX, answer different questions about the same name once the resolver has reached those servers.

Sources