# IPv4 parse

`ipv4-parse` · version 1.0.0 · URLs & IP addresses · free, no key needed

Parse a canonical dotted-decimal IPv4 address into octets and a uint32 integer string.

**Use when you need to: ipv4 parse · parse dotted decimal ipv4 · ipv4 to octets and uint32.**

## Supported

- ipv4 parse
- parse dotted decimal ipv4
- ipv4 to octets and uint32

## Not supported

- IPv6
- IPv4-mapped IPv6
- hexadecimal octets
- CIDR prefixes
- hostnames
- ports

## Behavior

- address is four decimal octets 0-255 separated by dots, with no spaces, hex, or IPv4-mapped IPv6.
- A zero octet is written 0; 00, 01, and other leading zeros are rejected.
- octets is the four JSON integers in left-to-right order.
- integer is the canonical integer string of o0*2^24 + o1*2^16 + o2*2^8 + o3, in 0..4294967295.

## Input

- `address` (string, required): max length 15; pattern `^(?:0|[1-9][0-9]{0,2})(?:\.(?:0|[1-9][0-9]{0,2})){3}$`

## Output

- `octets` (array of integer, required): min items 4; max items 4; each min 0; each max 255
- `integer` (string, required): max length 10; pattern `^(0|[1-9][0-9]*)$`

## Limits

- max address length: 15
- octet min: 0
- octet max: 255
- integer min: 0
- integer max: 4294967295

## Example

Request input:

```json
{
  "address": "192.168.1.1"
}
```

Response:

```json
{
  "result": {
    "octets": [
      192,
      168,
      1,
      1
    ],
    "integer": "3232235777"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "ipv4-parse",
  "version": "1.0.0",
  "input": {
    "address": "192.168.1.1"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/ipv4-parse/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"address":"192.168.1.1"}'
```

The machine-readable contract is at [/v1/tools/ipv4-parse/versions/1.0.0](/v1/tools/ipv4-parse/versions/1.0.0).

### CLI

```sh
node cli.mjs run ipv4-parse 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [IPv4 format](/tools/ipv4-format): Format a uint32 integer string or four octets as a canonical dotted-decimal IPv4 address.
- [IPv4 CIDR parse](/tools/ipv4-cidr-parse): Parse an IPv4 CIDR block into its network, broadcast, netmask, wildcard mask, usable host range and address counts.
- [IPv6 parse](/tools/ipv6-parse): Parse an IPv6 address (any RFC 4291 textual form) into its 8 hextets and a 128-bit integer string.
- [IPv4 address offset](/tools/ipv4-address-offset): Add a signed integer offset to an IPv4 address, throwing if the result leaves the IPv4 address space.
- [IPv4 mask convert](/tools/ipv4-mask-convert): Convert between an IPv4 prefix length, dotted subnet netmask, and dotted wildcard (host) mask.
- [IPv4 range to cidrs](/tools/ipv4-range-to-cidrs): Convert an arbitrary IPv4 address range into the minimal list of CIDR blocks that exactly covers it.
