FOR YOUR TERMINAL · 4 MIN READ

Your Public IP. One Command.

No banner, no markup, no extra fields. A command-line request to NAME2IP returns the source IP seen by the service, followed by one newline. A separate DNS endpoint resolves the names you choose.

No API keyIPv4 + IPv660 requests / minute

curl

Just the domain. No parameters needed.

Terminal
curl name2ip.info

That bare command uses HTTP. For an encrypted connection, use HTTPS:

Terminal
curl -fsS https://name2ip.info

-f reports HTTP errors as failures. -sS hides the progress meter while keeping error messages. These options help scripts avoid treating an error response as an address.

Example output · illustrative address203.0.113.42

Your result is your connection’s address, not this example.

wget

Print the IP directly to your terminal instead of saving a file.

Wget
wget -qO- https://name2ip.info

PowerShell

Use the dedicated plain-text endpoint in Windows PowerShell or PowerShell 7. Naming the command explicitly avoids shells where curl is an alias.

PowerShell
Invoke-RestMethod https://name2ip.info/ip

A Predictable Plain-Text Endpoint

/ip always returns one address and a newline, regardless of your user agent.

Terminal
curl -fsS https://name2ip.info/ip

JSON for Your Public IP

Use named fields when your script needs more than a line of text.

Terminal
curl -fsS https://name2ip.info/api/ip
Example JSON · illustrative address{"ip":"203.0.113.42","version":4}

ip is the source address observed for the request. version is 4 or 6. This response is non-cacheable and does not look up an arbitrary address supplied in a parameter.

PowerShell converts JSON into an object. Read its IP property directly:

PowerShell
(Invoke-RestMethod https://name2ip.info/api/ip).ip

IPv4 or IPv6?

Ask curl to use a specific address family. Your device and network need to support the family you request.

Terminal
curl -4 -fsS https://name2ip.info/ip
Terminal
curl -6 -fsS https://name2ip.info/ip

One successful request does not prove that both families work. NAT, VPNs, proxies and mobile networks can change the public address you see. This endpoint does not reveal your private LAN address or configured DNS resolver.

Domain Names to DNS Records

The DNS endpoint is separate from the caller-IP endpoints. Supply up to eight unique hostnames in names, separated by newlines, and one record selection in type.

Terminal
curl -fsS -G https://name2ip.info/api/dns \
  --data-urlencode 'names=name2ip.info' \
  --data-urlencode 'type=BOTH'

-G puts the encoded parameters in the query string. Use BOTH for A and AAAA queries, or choose A, AAAA, MX, NS, CNAME, TXT or CAA. Do not include a URL scheme or path in a hostname.

For a two-name batch in PowerShell:

PowerShell
$names = [uri]::EscapeDataString(@("name2ip.info", "www.name2ip.info") -join [Environment]::NewLine)
Invoke-RestMethod "https://name2ip.info/api/dns?names=$names&type=BOTH"

The JSON contains resolver and a results array. Each result keeps the queried name, requested type, DNS status and records. Successful resolver responses include the observed authenticated and truncated flags, fetchedAt and whether the result was cached. Records retain their actual owner name, numeric type, value and TTL observed at fetch time.

Read every result, not just the HTTP status.

HTTP 200 means the request returned data. A DNS result can still report NXDOMAIN, no answer records or an incomplete query. Inspect each result’s status and any error. If every upstream query fails, the endpoint returns HTTP 502 with the result details.

Queries go from this service to Cloudflare Public DNS—not your device’s configured resolver. Cached answers keep their original fetch time; they can be reused for up to 60 seconds, limited by the lowest answer TTL. This is one resolver’s view, not a worldwide propagation test. The Field Guide explains those limits.

Choose the Right Endpoint

GET /ip
Your source IP as plain text. No user-agent guessing.
GET /api/ip
Your source IP and its address family as JSON.
GET /api/dns
Public DNS results for the hostnames you submit.

SHARED RESOURCES / CLEAR LIMITS

60 Requests in Any 60 Seconds.

One hard, rolling allowance applies per source IP across pages, assets and endpoints. Browser visits, command-line requests and HEAD requests share it. People behind the same public IP, including shared NAT or VPN exits, share that budget.

DNS batches also have a separate limit of 6 requests per minute. One batch request can contain up to eight unique names; BOTH asks two DNS questions per name. The overall request allowance still applies.

On HTTP 429, wait for the number of seconds in Retry-After before retrying. Avoid tight polling loops and reuse observations when practical. These free endpoints have no uptime commitment.

Terminal
curl -sSI https://name2ip.info/ip

-I sends a HEAD request, so no IP body is returned. X-RateLimit-Limit shows the configured allowance and X-RateLimit-Remaining its remaining requests. Retry-After is supplied when a request is rate-limited.

KEEP EXPLORING

Useful Internet Tools

A little curiosity goes a long way. Find your next useful tool or plain-English guide.

13 more places to explore

Part of our independent learning network Browse a topic. Learn something useful.