# A record

An A record connects a name, such as example.com or www.example.com, to the IPv4 address of the server that answers for it. It is the most common DNS record: when you type a website's name, an A record is usually what tells your browser where to go.

- Record type: A
- Type number: 1
- Used for: Websites
- How common: Everyday
- Defined in: RFC 1035

## Format

```
<name> <ttl> IN A <IPv4 address>
```

| Field | What it means | Accepted values |
| --- | --- | --- |
| Name | The name being pointed. `@` is the domain itself; `www` is www.example.com. | A host name. Letters, digits and hyphens, up to 63 characters between dots and 253 in total. `*` for a wildcard. |
| TTL | How long resolvers may keep the answer before asking again. | Seconds. 300 to 3600 is typical; many DNS hosts offer Auto. |
| Address | The server's IPv4 address. | Four numbers from 0 to 255 separated by dots, such as `192.0.2.10`. No port, no `http://`, no name. |

## Examples

### The domain itself

```
@ 3600 IN A 192.0.2.10
```

example.com goes to 192.0.2.10.

### A subdomain

```
app 300 IN A 198.51.100.7
```

app.example.com goes to a different server. A short TTL makes a later move quicker.

### Several servers

```
@ 300 IN A 192.0.2.10
@ 300 IN A 192.0.2.11
```

Two A records at the same name. Resolvers return both and clients pick one, a simple way to spread load. There's no health checking: if one server is down, some visitors still get it.

### Wildcard

```
* 3600 IN A 192.0.2.10
```

Any name under example.com without its own records, such as anything.example.com, goes to 192.0.2.10.

## How an A record is used

When a browser opens example.com, it asks a resolver (usually run by your internet provider, or a public one such as 1.1.1.1 or 8.8.8.8) for the A records of example.com. The resolver asks the domain's nameservers, caches the answer for the TTL, and hands back the address. The browser then connects to that address.

A records only hold addresses. They know nothing about ports, paths or https: the web server decides which site to show using the name the browser sends. That's why many websites can share one IP address.

## A record or CNAME?

Use an A record when you know the server's IP address and it rarely changes, such as your own server or a host that gives you a fixed address. Use a [CNAME](https://lemon.domains/dns-records/cname) when a service gives you a host name instead, such as `yourshop.myshopify.com` or `cname.vercel-dns.com`, so they can change their addresses without you editing anything.

At the root of a domain (@) you can't use a CNAME. Use an A record with the address your host gives you, or an [ALIAS](https://lemon.domains/dns-records/alias) record if your DNS host offers one.

## TTL

3600 (one hour) suits a stable server. Drop it to 300 a day before you move servers so the change spreads in minutes, then raise it again afterwards.

## Common mistakes

- Putting a name or a web address in the value. An A record takes only an IPv4 address; for a name use a CNAME.
- Putting an IPv6 address in an A record. IPv6 addresses go in [AAAA records](https://lemon.domains/dns-records/aaaa).
- Adding an A record at a name that already has a CNAME. A name with a CNAME can't have anything else, so most DNS hosts refuse it.
- Leaving an old A record next to a new one after moving servers, so some visitors still reach the old server.
- Using a private address such as 192.168.1.10 for a public website. It only works on your own network.

## At your DNS host

- Cloudflare: the orange cloud (Proxied) answers with Cloudflare's addresses instead of yours, so a lookup won't show the address you entered. Grey cloud (DNS only) publishes your address as it is.
- Route 53: leave Record name blank for the domain itself. For AWS load balancers and CloudFront, use an Alias record instead of a fixed address.
- GoDaddy, Namecheap: type @ in Host or Name for the domain itself, and remove any parking A record the registrar added first.
- Most dashboards add the domain for you: type www, not www.example.com, or you may end up with www.example.com.example.com.

## Questions

### What does an A record do?

It tells the internet which IPv4 address a name lives at. When someone visits example.com, their browser looks up its A record and connects to that address.

### Can a domain have more than one A record?

Yes. Several A records at the same name are all returned, and clients spread their connections between them. There's no health checking, so remove an address as soon as its server goes away.

### What does A stand for?

Address. The AAAA record is the IPv6 version, named because IPv6 addresses are four times as long (128 bits instead of 32).

### How long does an A record change take to work?

Up to the old record's TTL. Resolvers that cached the old address keep using it until the TTL runs out, so lower the TTL before a planned change.

## Related

- [AAAA record](https://lemon.domains/dns-records/aaaa.md)
- [CNAME record](https://lemon.domains/dns-records/cname.md)
- [ALIAS and ANAME records](https://lemon.domains/dns-records/alias.md)
- [HTTPS record](https://lemon.domains/dns-records/https.md)
- [PTR record](https://lemon.domains/dns-records/ptr.md)

Interactive version with a record checker and live lookup: https://lemon.domains/dns-records/a
