# IP Address Converter

Convert IP addresses between notations. IPv4 or IPv6 to unsigned integer, hex and binary (and back from integers), with the signed 32-bit value for databases. IPv4 returns every standard IPv6 embedding: IPv4-mapped, NAT64 (well-known, local-use and your own prefix), 6to4, deprecated IPv4-compatible and ISATAP. IPv6 returns the embedded IPv4 and its type (mapped, NAT64, 6to4, Teredo with server/client/port, ISATAP) or "none" for native addresses. Up to 500 addresses. Pure calculation, no network access.

**Not for:** Getting a working IPv6 address for a server (conversion does not create one) or looking up an address owner (use ip_whois).

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

## Input

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `address` | string | yes |  | One or more IP addresses, one per line (commas and spaces also separate), up to 500. IPv4 dotted quads, IPv6 in any form, or integers written as decimal (3232235777), 0x hex (0xc0a80101) or 0b binary. Leading zeros in a dotted quad are rejected because they are ambiguous. max length 32768 |
| `mode` | "all" \| "decimal" \| "v4-to-v6" \| "v6-to-v4" | no | `"all"` | decimal: integer, hex and binary forms. v4-to-v6: IPv6 embeddings of IPv4 addresses. v6-to-v4: extract the IPv4 inside IPv6 addresses. all: whatever applies. |
| `nat64Prefix` | string | no |  | Your own NAT64 prefix (/32, /40, /48, /56, /64 or /96, RFC 6052), e.g. 2001:db8:64::/96, used to embed and to extract. max length 64 |

## Output

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

| Field | Type | Description |
|---|---|---|
| `items` | object[] |  |
| `totals` | object |  |
| `truncated` | boolean |  |

## Examples

### IPv4 address to decimal

```json
{"address":"192.168.1.1","mode":"decimal"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-convert?address=192.168.1.1&mode=decimal'
```

Web page: https://lookupowl.com/ip-to-decimal?q=192.168.1.1

### Integer back to an address

```json
{"address":"3232235777\n0xc0a80101","mode":"decimal"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-convert?address=3232235777%0A0xc0a80101&mode=decimal'
```

Web page: https://lookupowl.com/ip-to-decimal?q=3232235777%0A0xc0a80101

### IPv4 inside IPv6

```json
{"address":"192.0.2.33","mode":"v4-to-v6"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-convert?address=192.0.2.33&mode=v4-to-v6'
```

Web page: https://lookupowl.com/ipv4-to-ipv6?q=192.0.2.33

### Find the IPv4 in an IPv6 address

```json
{"address":"::ffff:192.0.2.1\n64:ff9b::8.8.8.8\n2001:0:4136:e378:8000:63bf:3fff:fdd2\n2606:4700:4700::1111","mode":"v6-to-v4"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-convert?address=%3A%3Affff%3A192.0.2.1%0A64%3Aff9b%3A%3A8.8.8.8%0A2001%3A0%3A4136%3Ae378%3A8000%3A63bf%3A3fff%3Afdd2%0A2606%3A4700%3A4700%3A%3A1111&mode=v6-to-v4'
```

Web page: https://lookupowl.com/ipv6-to-ipv4?q=%3A%3Affff%3A192.0.2.1%0A64%3Aff9b%3A%3A8.8.8.8%0A2001%3A0%3A4136%3Ae378%3A8000%3A63bf%3A3fff%3Afdd2%0A2606%3A4700%3A4700%3A%3A1111

## Web pages

- https://lookupowl.com/ip-to-decimal
- https://lookupowl.com/ipv4-to-ipv6
- https://lookupowl.com/ipv6-to-ipv4

## 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: results are kept for 86400 s.
- Timeout: 1 s.

## Related tools

- [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 Subnet Calculator](https://lookupowl.com/tools/subnet-calculator.md): Network, broadcast, usable range, masks and exact host counts for any IPv4 or IPv6 subnet.
- [CIDR / IP Range Converter](https://lookupowl.com/tools/ip-range-convert.md): Turn CIDR blocks into first/last addresses, and IP ranges into the minimal list of CIDR blocks.
- [IP WHOIS Lookup](https://lookupowl.com/tools/ip-whois.md): Who owns an IPv4 or IPv6 address: network range, name, country, registry, abuse contact and origin AS, from RDAP.

## Guide: IP address to decimal converter

Decimal, hex, binary and integer forms of any IP address.

### Why an IP address is also a number

An IPv4 address is a 32-bit number written as four bytes. `192.168.1.1` is `192 * 256^3 + 168 * 256^2 + 1 * 256 + 1`, which is **3,232,235,777**. IPv6 is the same idea with 128 bits. Databases and firewalls often store addresses as integers because numbers are compact, sort properly and are quick to compare against a range.

| Form | 192.168.1.1 |
|---|---|
| Dotted decimal | `192.168.1.1` |
| Unsigned integer | `3232235777` |
| Hexadecimal | `0xc0a80101` |
| Hexadecimal, dotted | `0xc0.0xa8.0x01.0x01` |
| Binary | `11000000.10101000.00000001.00000001` |
| Signed 32-bit integer | `-1062731519` |

### How to use it

1. **Enter addresses or numbers**: One per line, up to 500 (commas and spaces work too). You can use dotted IPv4, IPv6 in any notation, decimal integers (`3232235777`), hex with a `0x` prefix (`0xc0a80101`) and binary with a `0b` prefix (`0b11000000101010000000000100000001`).
2. **Read every form**: Each address shows its integer, hex and binary forms and what kind of address it is, such as private or public. IPv4 also gets the signed 32-bit number that a plain `INT` column would hold.
3. **Go the other way**: Paste a number to get the address it stands for. The result notes which notation it read, so you can check it took your number the way you meant.

> **From Claude, ChatGPT or Cursor** Connect the LookupOwl MCP server and ask: “What is 192.168.1.1 as a decimal number?” The assistant calls `ip_convert` and gets the integer, hex and binary forms, the signed 32-bit value and what kind of address it is. It takes up to 500 addresses or numbers in one call, and a number comes back as the address it stands for.

### Where the number is used

- **Databases.** MySQL's `INET_ATON()` and `INET_NTOA()` convert between text and integers, and PostgreSQL has a native `inet` type. A signed 32-bit `INT` cannot hold addresses above 127.255.255.255 as positive numbers, so use `INT UNSIGNED` or `BIGINT`.
- **Range checks.** An address is inside a block when its integer lies between the block's first and last integers, which makes a fast `BETWEEN` query. The [CIDR to range converter](https://lookupowl.com/cidr-to-ip-range) gives you both numbers.
- **Geolocation and ASN data.** Some datasets ship as start and end integers.
- **Log analysis.** Sorting numerically puts `10.0.0.2` before `10.0.0.10`, which text sorting does not.
- **IPv6.** The integer can have up to 39 digits, so store it as `DECIMAL(39,0)` or `BINARY(16)`, or in a native type, not in a 64-bit integer.

> **Decimal IPs in links** Many browsers will open `http://3232235777/` as `192.168.1.1`. Attackers use decimal, hex and octal forms to disguise a destination in phishing links and to slip past naive SSRF filters, the checks that try to stop a server fetching internal addresses. Paste a decimal or hex host here to see the address it really means.

### Common problems

- **Leading zeros.** `010.001.002.003` is ambiguous, because some software reads a leading zero as octal. The tool rejects it and shows both readings instead of guessing.
- **IPv4 or IPv6?** A decimal number up to 4,294,967,295 is read as IPv4. Hex with up to 8 digits and binary with up to 32 bits count as IPv4 too. Anything longer is read as IPv6, up to 340,282,366,920,938,463,463,374,607,431,768,211,455 (2^128 - 1), and a bigger number is rejected. A zero-padded `0x000000001` is 9 digits, so it comes out as `::1`.
- **Negative numbers.** Some databases store an address as a signed 32-bit number, so it can come out negative. Add 4,294,967,296 to get the unsigned integer and paste that here. The negative value itself is not accepted.
- **Byte order.** Network byte order is big-endian, which means the most significant byte comes first. A few systems and some hex dumps show the bytes reversed, so `0x0101a8c0` is `192.168.1.1` read little-endian.
- **Short forms.** `127.1` works in some programs but is not standard, and is not accepted here.
- **Networks.** A block with a prefix, like `10.0.0.0/8`, is not converted here. Use the [CIDR to range converter](https://lookupowl.com/cidr-to-ip-range) or the [subnet calculator](https://lookupowl.com/subnet-calculator).

### How it works

Each address is parsed strictly and held as a `BigInt`, so even 128-bit numbers are exact. IPv4 addresses are 32 bits long (RFC 791) and IPv6 addresses 128 bits (RFC 4291). The conversion is plain arithmetic, done on our server with no network lookup. To pull the IPv4 out of an IPv6 address, or the reverse, use [IPv6 to IPv4](https://lookupowl.com/ipv6-to-ipv4) and [IPv4 to IPv6](https://lookupowl.com/ipv4-to-ipv6). For subnet maths on the same numbers use the [subnet calculator](https://lookupowl.com/subnet-calculator).

### Frequently asked questions

**How do I convert an IP address to a decimal number?**

Multiply each of the four parts by 256 raised to its position, then add the results. The first part counts 256^3, the second 256^2, the third 256 and the last counts as it is, so 10.0.0.1 is 10 * 16,777,216 + 1 = 167,772,161. Or paste the address above and read the integer.

**What is 192.168.1.1 in decimal?**

It is 3232235777, which is `0xc0a80101` in hexadecimal and `11000000.10101000.00000001.00000001` in binary. As a signed 32-bit number it is -1062731519. The address is in a private range, so it only means something inside a home or office network, never on the public internet.

**Why is the signed value negative?**

A signed 32-bit integer stores numbers from -2,147,483,648 to 2,147,483,647. Addresses above 127.255.255.255 do not fit in that range, so code that wraps them around turns them into negative numbers. That can surprise you in a database column, and an unsigned column avoids it.

**Can I convert a decimal number back to an IP address?**

Yes. Paste the number and you get the address it stands for. A decimal number, a hex number with a `0x` prefix or a binary number with a `0b` prefix all work, and the result notes which one it read. Whether the answer is an IPv4 or an IPv6 address depends on the size of the number, as the common problems above explain.

**Does it support IPv6?**

Yes. An IPv6 address converts to a 128-bit integer of up to 39 digits, plus its hex and binary forms and its address type. The signed 32-bit value is IPv4 only, because it has no meaning for a 128-bit number.

**Can I convert a whole list at once?**

Yes, up to 500 addresses or numbers at a time, one per line. Each line gets its own result, so a typo on one line shows an error for that line only and the rest still convert. Anything past 500 is left out, and the JSON result shows `truncated: true`.

**Are my addresses uploaded anywhere?**

Yes, to our server, because the conversion runs there, on the web page as well as through the API or an AI assistant. The addresses are not written to our logs and are held in memory for at most a day. On the website, Google Analytics also records what you enter. The [privacy policy](https://lookupowl.com/privacy) has the details.
