# DNS Records Explained Simply (For Beginners)

## How does a browser know where a website lives?

When you type [`google.com`](http://google.com) in your browser, your computer doesn’t magically know where it is.  
It needs an address — just like you need a house address to visit someone.

That’s where **DNS** comes in.

## What is DNS? (Very simple)

**DNS is the phonebook of the internet.**

* You remember names like [`example.com`](http://example.com)
    
* Computers understand numbers like `142.250.190.14`
    

DNS connects the **name** to the **number**.

## What is DNS? (Very simple)

**DNS is the phonebook of the internet.**

* You remember names like [`example.com`](http://example.com)
    
* Computers understand numbers like `142.250.190.14`
    

DNS connects the **name** to the **number**.

![What is DNS - Domain Name System ? - sagarfive](https://lh6.googleusercontent.com/9HL6XqrvIqt7YlVfRsCp9dpVfg6sj8aJ-M1FO-nzL0XLkGLpOBbe_orlVbdo9VeGpGFHFMgi_POOGzi83HGl1A1dHkZDfDsaC0XdZ2SzyBJ0bLy84ABckxC74a17mX11RcyyK_3QMIAu5sMl2dqfAUXZ6wmUGtZzEqxKGCnTX-uhEpcOUN8oazTf8Ccm5A align="left")

## Why do we need DNS records?

A domain name needs different instructions:

* Where the website is hosted
    
* Who handles email
    
* Which service owns the domain
    
* Extra verification info
    

Each instruction is stored as a **DNS record**.

## NS Record – Who is responsible for this domain?

**NS (Name Server) records decide who controls the domain’s DNS.**

They answer:

> “Which DNS service should be trusted for this domain?”

```plaintext
ns1.hostinger.com
ns2.hostinger.com
```

If NS records point to Hostinger, Hostinger manages all other records.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769534055588/6c61a6d9-41a8-43c8-83ae-4403f766d412.png align="center")

## A Record Domain - IPv4 address

**A record connects a domain to a server IP (IPv4).**

Eg:

```plaintext
example.com → 93.184.216.34
```

This is how browsers reach your website server.

![DNS Basics: How Domain Name System Connects Websites - DEV Community](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxlqzaobhutmuxtnc8m09.jpeg align="left")

## AAAA Record – Domain → IPv6 address

Same as an A record, but for **IPv6** (newer IP format).

Eg:

```plaintext
example.com → 2606:2800:220:1:248:1893:25c8:1946
```

Not mandatory, but good to have if your server supports IPv6.

## CNAME Record – One name pointing to another name

**CNAME is an alias.**

Instead of pointing to an IP, it points to another domain.

Eg:

```plaintext
www.example.com → example.com
```

So you don’t manage multiple IPs.

**A record → IP address**  
**CNAME → another domain name**

![](https://0xpatrik.com/content/images/2018/06/notation.png align="left")

## MX Record – How emails find your mail server

**MX (Mail Exchange) records tell emails where to go.**

When someone emails [`you@example.com`](mailto:you@example.com), MX records guide the email to the correct mail server.

Eg:

```plaintext
example.com → mail.google.com
```

**NS = who controls DNS  
MX = who receives email**

![Configure MX Records for Google Workspace Email Setup](https://cdn.prod.website-files.com/644fc991ce69ff211edbeb95/6784e2f1ada454ed0dee61b5_6784df6df41a3ae516b22e52_image3.png align="left")

## TXT Record - Extra information & verification

**TXT records store plain text instructions.**

Used for:

* Domain verification
    
* Email security (SPF, DKIM)
    
* Ownership proof
    

Example:

```plaintext
"v=spf1 include:_spf.google.com ~all"
```

You usually don’t “use” TXT records directly — services ask you to add them.

## How all DNS records work together (one website example)

For a simple website:

* **NS** → DNS provider
    
* **A / AAAA** → Website server
    
* **CNAME** → `www` handling
    
* **MX** → Email service
    
* **TXT** → Verification & security
    

All records work silently in the background — fast and invisible.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1769535359777/bcd10613-b054-44d9-952d-c711517cac6c.png align="center")
