Skip to main content

Reverse DNS PTR Name Converter API

REAL DATA

Encode IPv4 and IPv6 addresses as canonical reverse-DNS PTR owner names, or decode complete in-addr.arpa and ip6.arpa names without a DNS query.

Authoritative reference data or standards computation

Base URL
/api/reverse-dns
Capabilities
2 routes
Last updated
July 29, 2026
Data source

GET /api/reverse-dns/encode

Parses one strict IP address locally and returns its canonical family-specific reverse name; no DNS request occurs.

Live requestRuns against the public API
No key required
GET/api/reverse-dns/encode?ip=10.2.0.52

Request parameters

Strict IPv4 or IPv6 address. IPv6 may be compressed or end with an embedded dotted-decimal IPv4 address; brackets and zone identifiers are rejected.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/reverse-dns/encode?ip=10.2.0.52"
const res = await fetch("https://randomapi.dev/api/reverse-dns/encode?ip=10.2.0.52");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/reverse-dns/encode?ip=10.2.0.52").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/reverse-dns/encode?ip=10.2.0.52"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 1
ip string required

Strict IPv4 or IPv6 address. IPv6 may be compressed or end with an embedded dotted-decimal IPv4 address; brackets and zone identifiers are rejected.

allowed: 2 – 45
example: ip=10.2.0.52
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=family,ip
exclude list

Return all fields except these (comma-separated).

example: exclude=zone
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 4
family integer

IP address family: 4 for IPv4 or 6 for IPv6.

example: 4

ip string (IP address)

Canonical IP address decoded from or encoded into the reverse name.

example: 10.2.0.52

reverseName string (absolute DNS name)

Canonical lowercase PTR owner name with its root-label trailing dot.

example: 52.0.2.10.in-addr.arpa.

zone string (absolute DNS name)

Reverse namespace selected for the address family.

example: in-addr.arpa.

Documented examples

Build-generated requests and complete responses
3
Encode an IPv4 address
GET /api/reverse-dns/encode?ip=10.2.0.52
{
  "data": {
    "family": 4,
    "ip": "10.2.0.52",
    "reverseName": "52.0.2.10.in-addr.arpa.",
    "zone": "in-addr.arpa."
  },
  "meta": {
    "endpoint": "reverse-dns",
    "route": "/encode",
    "params": {
      "ip": "10.2.0.52"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Encode a compressed IPv6 address
GET /api/reverse-dns/encode?ip=2001%3Adb8%3A%3A567%3A89ab
{
  "data": {
    "family": 6,
    "ip": "2001:db8::567:89ab",
    "reverseName": "b.a.9.8.7.6.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.",
    "zone": "ip6.arpa."
  },
  "meta": {
    "endpoint": "reverse-dns",
    "route": "/encode",
    "params": {
      "ip": "2001:db8::567:89ab"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Encode an IPv4-mapped IPv6 address
GET /api/reverse-dns/encode?ip=%3A%3Affff%3A192.0.2.1
{
  "data": {
    "family": 6,
    "ip": "::ffff:192.0.2.1",
    "reverseName": "1.0.2.0.0.0.0.c.f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.",
    "zone": "ip6.arpa."
  },
  "meta": {
    "endpoint": "reverse-dns",
    "route": "/encode",
    "params": {
      "ip": "::ffff:192.0.2.1"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

GET /api/reverse-dns/decode

Requires a full host reverse name, canonicalizes the optional root dot and reconstructs the exact IPv4 or IPv6 address.

Live requestRuns against the public API
No key required
GET/api/reverse-dns/decode?name=52.0.2.10.in-addr.arpa.

Request parameters

Complete in-addr.arpa or 32-nibble ip6.arpa name. The final root dot is optional; partial zones and ip6.int are rejected.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/reverse-dns/decode?name=52.0.2.10.in-addr.arpa."
const res = await fetch("https://randomapi.dev/api/reverse-dns/decode?name=52.0.2.10.in-addr.arpa.");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/reverse-dns/decode?name=52.0.2.10.in-addr.arpa.").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/reverse-dns/decode?name=52.0.2.10.in-addr.arpa."
), true);
$data = $json["data"];
Parameters Route-specific request inputs 1
name string required

Complete in-addr.arpa or 32-nibble ip6.arpa name. The final root dot is optional; partial zones and ip6.int are rejected.

allowed: 12 – 80
example: name=52.0.2.10.in-addr.arpa.
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=family,ip
exclude list

Return all fields except these (comma-separated).

example: exclude=zone
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 4
family integer

IP address family: 4 for IPv4 or 6 for IPv6.

example: 4

ip string (IP address)

Canonical IP address decoded from or encoded into the reverse name.

example: 10.2.0.52

reverseName string (absolute DNS name)

Canonical lowercase PTR owner name with its root-label trailing dot.

example: 52.0.2.10.in-addr.arpa.

zone string (absolute DNS name)

Reverse namespace selected for the address family.

example: in-addr.arpa.

Documented examples

Build-generated requests and complete responses
2
Decode a complete IPv4 reverse name
GET /api/reverse-dns/decode?name=52.0.2.10.in-addr.arpa.
{
  "data": {
    "family": 4,
    "ip": "10.2.0.52",
    "reverseName": "52.0.2.10.in-addr.arpa.",
    "zone": "in-addr.arpa."
  },
  "meta": {
    "endpoint": "reverse-dns",
    "route": "/decode",
    "params": {
      "name": "52.0.2.10.in-addr.arpa."
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Decode an all-zero IPv6 reverse name
GET /api/reverse-dns/decode?name=0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa
{
  "data": {
    "family": 6,
    "ip": "::",
    "reverseName": "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.",
    "zone": "ip6.arpa."
  },
  "meta": {
    "endpoint": "reverse-dns",
    "route": "/decode",
    "params": {
      "name": "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa."
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

About this API

Coverage & behavior

Builds and decodes the DNS owner names used for PTR records without sending a network request. IPv4 octets are reversed beneath in-addr.arpa.; every one of an IPv6 address's 32 hexadecimal nibbles is reversed into its own label beneath ip6.arpa..

/encode accepts the same strict IPv4 and IPv6 syntax as the platform's CIDR tools, including compressed IPv6 and an embedded dotted-decimal IPv4 tail. It returns a canonical IP address and an absolute, lowercase reverse name with a trailing root-label dot.

/decode accepts a complete reverse name with or without the final dot and canonicalizes it in the response and meta.params. An IPv4 name must contain exactly four decimal octet labels with no leading zeroes. An IPv6 name must contain exactly 32 single-hexadecimal-nibble labels. Partial reverse zones, malformed labels and the obsolete ip6.int namespace return 400 rather than being guessed.

This endpoint only performs deterministic text conversion. It does not query DNS, confirm that a PTR record exists or return a hostname stored in one.

Use it for

  • Build PTR query names for DNS diagnostic and provisioning tools
  • Decode reverse-zone owner names in DNS logs and configuration reviews
  • Canonicalize IPv4 and IPv6 reverse names before comparing zone records
  • Generate exact reverse-DNS fixtures without relying on a resolver or network

Frequently asked questions

Does this API perform a live reverse DNS lookup?

No. It deterministically converts between IP addresses and PTR owner names; it never queries DNS or claims that a PTR record exists.

How are IPv6 reverse DNS names encoded?

The canonical 128-bit address is expanded to 32 hexadecimal nibbles, reversed one nibble per label and placed below ip6.arpa. as required by RFC 3596.

Can I decode a partial reverse DNS zone?

No. /decode deliberately requires all four IPv4 octets or all 32 IPv6 nibbles, so a partial delegation is never misrepresented as one host address.

Are trailing dots and uppercase IPv6 nibbles accepted?

Yes. The input root dot is optional and hexadecimal input is case-insensitive; output is always lowercase and includes the canonical trailing dot.

Standards & references