# IP Address Validator: Strict Check and Parser Differences

Validate IPv4 and IPv6 strings, one per line (up to 1,000), and show how three kinds of reader interpret each one: a strict parser (RFC 791, Python ipaddress, Go netip), the WHATWG URL parser used by browsers and Node fetch, and inet_aton as used by curl and ping. Leading zeros (012.0.0.1), short forms (127.1), hex and octal parts and whole numbers (2130706433) are refused by strict readers but read as another address by the others. Returns, per line, the strict verdict with a reason code, what each reader gets, whether they agree, whether the lenient reading is an internal address in disguise (a server-side request forgery risk), the canonical form and the arithmetic. Pure computation, no network.

**Not for:** Telling who owns an address (use ip_whois) or what kind a valid address is (use ip_classify).

- Tool id: `ip-validate`
- Category: ip
- Execution: pure
- MCP tool `ip_validate` at https://lookupowl.com/mcp
- REST `GET https://lookupowl.com/api/v1/tools/ip-validate` (or POST a JSON body)
- OpenAPI: https://lookupowl.com/api/openapi.json

## Input

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `input` | string | yes |  | One or many IP address strings, one per line, up to 1,000 lines. Brackets, ports, zone ids and a URL wrapper are recognised and set aside. min length 1, max length 64000 |

## Output

Results are wrapped in an envelope: `tool`, `version`, `requestId`, `data`, `summary`, `meta` (cache status, timing), `permalink`. `data` has these fields:

| Field | Type | Description |
|---|---|---|
| `summary` | object |  |
| `items` | object[] |  |
| `truncated` | boolean | More than 1,000 lines were given; the first 1,000 were read. |
| `unread` | number | How many lines were not read because of the 1,000 line limit. |

## Examples

### A leading zero: 012.0.0.1

```json
{"input":"012.0.0.1"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-validate?input=012.0.0.1'
```

Web page: https://lookupowl.com/ip-validator?q=012.0.0.1

### A short form: 127.1

```json
{"input":"127.1"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-validate?input=127.1'
```

Web page: https://lookupowl.com/ip-validator?q=127.1

### The cloud metadata address in octal: 0251.0376.0251.0376

```json
{"input":"0251.0376.0251.0376"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-validate?input=0251.0376.0251.0376'
```

Web page: https://lookupowl.com/ip-validator?q=0251.0376.0251.0376

### A list of six strings

```json
{"input":"192.168.1.1\n012.0.0.1\n[2001:db8::1]:443\n256.1.1.1\n127.1\n2001:DB8:0:0:0:0:0:1"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-validate?input=192.168.1.1%0A012.0.0.1%0A%5B2001%3Adb8%3A%3A1%5D%3A443%0A256.1.1.1%0A127.1%0A2001%3ADB8%3A0%3A0%3A0%3A0%3A0%3A1'
```

Web page: https://lookupowl.com/ip-validator

## Web pages

- https://lookupowl.com/ip-validator

## Limits and caching

- Cost: 1 unit for a live lookup, 1 unit for a cached one. Budgets are per network and published in the `RateLimit` response headers.
- Cache: the lifetime follows the data (for DNS, the record TTL, within a few minutes).
- Timeout: 5 s.

## Related tools

- [IP Address Type Checker: Private, CGNAT or Public?](https://lookupowl.com/tools/ip-classify.md): Check what kind an IP address or block is: private, shared (CGNAT), link-local, documentation, multicast, reserved or public, with the RFC.
- [Extract IP Addresses From Text, Logs and Reports](https://lookupowl.com/tools/ip-extract.md): Pull every IPv4 and IPv6 address out of pasted text, including defanged ones, with counts and a type for each. It runs in your browser.
- [IP Address Converter](https://lookupowl.com/tools/ip-convert.md): Convert IP addresses to decimal, hex and binary, IPv4 to IPv6 forms, and pull the IPv4 out of an IPv6 address.
- [IPv6 Compress and Expand](https://lookupowl.com/tools/ipv6-format.md): Shorten IPv6 addresses to RFC 5952 canonical form, or expand them to the full 32-digit form.
- [IP Location Lookup](https://lookupowl.com/tools/ip-location.md): Where an IP address is: city, region, country and the network that runs it, from DB-IP, with an honest accuracy note.

## Guide: IP address validator

Check whether a string is a valid IP address, and see what each program would really connect to.

### Why a valid-looking address can mean something else

The same text can be refused by one program and read as an address by another. A strict parser, as in Python or Go, refuses `012.0.0.1` because of the leading zero. The tools that open the connection, such as curl and ping, read it as octal and connect to `10.0.0.1`. A filter that checks the text as written lets it through, and that gap is how server-side request forgery (SSRF) filters get bypassed.

This page shows the strict answer and what each kind of reader gets, side by side, with the arithmetic. It says plainly when an address in disguise lands on a private, loopback or link-local address. It decodes; it has no control that makes an address look like another.

### The three readers

| Reader | Used by | What it does with 012.0.0.1 |
|---|---|---|
| Strict (RFC 791 and RFC 4291) | Python ipaddress, Go netip, Django after the fix | Refuses it: the leading zero is ambiguous |
| WHATWG URL parser | Browsers, Node fetch | Reads it as `10.0.0.1` (octal 012 is 10) |
| inet_aton | curl, ping and most C tools | Reads it as `10.0.0.1` |

A row that reads the same address as the strict reader is marked the same. A row that reads another address is a warning. A row that refuses the text is neutral, because refusing is the right answer. Real outputs behind the table were taken from Python, Node, `inet_aton` and `ping`; [SANS ISC diary 30348](https://isc.sans.edu/diary/30348) shows `010.010.010.010` reaching `8.8.8.8`, and the fix for [CVE-2021-33571](https://nvd.nist.gov/vuln/detail/CVE-2021-33571) made Django refuse leading zeros.

### Forms that read as another address

| Written as | Browsers and curl read it as | Why |
|---|---|---|
| `012.0.0.1` | `10.0.0.1` | A leading zero means octal: 012 is 10 |
| `010.010.010.010` | `8.8.8.8` | Each 010 is octal for 8 |
| `127.1` | `127.0.0.1` | A short form: the last number fills the remaining 24 bits |
| `0x7f.1` | `127.0.0.1` | Hex 0x7f is 127, then the short form |
| `2130706433` | `127.0.0.1` | One whole number is the 32 bits of the address |
| `1.2.3` | `1.2.0.3` | The last number fills 16 bits |
| `256.1.1.1` | refused by every reader | A part is above 255 |

### Brackets, ports, zone ids and URLs

You can paste an address the way it was written: `[2001:db8::1]:443`, `fe80::1%eth0` or `http://[::1]:8080/`. The page removes the wrapper, names what it removed, and validates the address inside. A wrapper is never a reason to refuse the line. An IPv6 address with a dotted tail, such as `::ffff:192.168.0.1`, is valid; browsers rewrite it as `[::ffff:c0a8:1]`, which is the same address.

### What happens to what you paste

With JavaScript on, the text is read in your browser and nothing you paste is sent to us or saved. Without JavaScript, the form asks our server, which reads the page address, answers and keeps nothing; the address holds what you typed, so share it only if you mean to. See the [privacy policy](https://lookupowl.com/privacy).

### Frequently asked questions

**Is 127.1 a valid IP address?**

Not to a strict parser. Browsers and tools such as ping read it as `127.0.0.1`, the computer you are on. That difference is why the page shows each reader separately.

**What is an internal address in disguise?**

A text that a strict parser refuses, but that a browser or curl reads as a private, loopback or link-local address, such as `0251.0376.0251.0376`, which reads as `169.254.169.254`, the address cloud servers use for their own settings and keys. A filter that checks the text may miss it; the connection does not.

**How do I validate an address safely in code?**

Parse it with a strict library and check the parsed address, never the text. The page gives tested snippets for Python, Go and Node, and an IPv4 regex that refuses leading zeros and short forms. Use a library for IPv6.

**Does the validator send what I paste anywhere?**

No. With JavaScript it reads your text in the browser. Without JavaScript the form asks our server for that one request, and nothing is kept.
