Tools

News

Notícias

Classificados

Cursos

Broker

IPv4:
IPv6:
UpOrDown
Ping
MTR
MTU Detect
Portscan
DNS
HTTP/SSL
My IP
IP Calc & Sum

My IP

Retrieve your public IPv4/IPv6 address via a simple web interface or API endpoint. Integrate instant client IP detection into scripts and applications for dynamic network setups.

IPv4:
IPv6:

Use one of the methods below in your application or command line.
The return will always be the IPv4 or IPv6 of the requester.

There are 3 hosts available that detect IP.

  • ip.isp.tools – Detects IPv4 or IPv6. Responds with the IP used in the connection.
  • ipv4.isp.tools – Forces resolution of IPv4 only.
  • ipv6.isp.tools – Forces resolution of IPv6 only.

Choose one of the hosts and call it using the curl command.

Example:

				
					curl ip.isp.tools
curl ipv4.isp.tools
curl ipv6.isp.tools
				
			

You can also force curl to connect to a version:

				
					$ curl -4 ip.isp.tools
$ curl -6 ip.isp.tools
				
			

Or automate it by inserting it into ~/.bashrc:

				
					$ printf '\n# ISP.Tools IP helpers
ip()   { [ "$#" -eq 0 ] && curl -fsSL ip.isp.tools   || command ip   "$@"; }
ipv4() { [ "$#" -eq 0 ] && curl -fsSL ipv4.isp.tools || command ipv4 "$@"; }
ipv6() { [ "$#" -eq 0 ] && curl -fsSL ipv6.isp.tools || command ipv6 "$@"; }
export -f ip ipv4 ipv6\n' >> ~/.bashrc && source ~/.bashrc
				
			

And use it like this:

				
					$ ip
179.104.127.31

$ ipv4
179.104.127.31

$ ipv6
2804:1e68:300f:d1af:f8d9:dfa1:3278:acb3
				
			
				
					// Javascript 
const fetch = require('node-fetch');
const url   = 'https://ip.isp.tools/json';
fetch(url)
  .then(res  => res.json())
  .then(data => console.log(data.ip));

				
			
				
					// React: fetch and hooks
import React, { useState, useEffect } from 'react';

function IPDisplay() {
  const [ip, setIp] = useState('');

  useEffect(() => {
    fetch('https://ip.isp.tools/json')
      .then(res => res.json())
      .then(data => setIp(data.ip))
      .catch(err => console.error(err));
  }, []);

  return (
    <div>
      <h1>Your IP:</h1>
      <p>{ip ? ip : "Loading..."}</p>
    </div>
  );
}

export default IPDisplay;

				
			
				
					// React: fetch with async/await
import React, { useState, useEffect } from 'react';

function IPFetcher() {
  const [ip, setIp] = useState('');

  useEffect(() => {
    async function fetchIp() {
      try {
        const res = await fetch('https://ip.isp.tools/json');
        const data = await res.json();
        setIp(data.ip);
      } catch (error) {
        console.error(error);
      }
    }
    fetchIp();
  }, []);

  return (
    <div>
      <h2>Your IP Address</h2>
      <p>{ip || 'Loading...'}</p>
    </div>
  );
}

export default IPFetcher;

				
			
				
					<div x-data="{ ip: 'Loading...' }" x-init="fetch('https://ip.isp.tools/json')
    .then(response => response.json())
    .then(data => { ip = data.ip })
    .catch(error => { ip = 'Error fetching IP' })">
  <h1>Your IP Address:</h1>
  <p x-text="ip"></p>
</div>
				
			
				
					<template>
  <div>
    <h1>Your IP Address:</h1>
    <p>{{ ip }}</p>
  </div>
</template>

<script>
import { ref, onMounted } from 'vue';

export default {
  setup() {
    const ip = ref('Loading...');

    onMounted(async () => {
      try {
        const response = await fetch('https://ip.isp.tools/json');
        const data = await response.json();
        ip.value = data.ip;
      } catch (error) {
        ip.value = 'Error fetching IP';
        console.error(error);
      }
    });

    return { ip };
  }
};
</script>

				
			
				
					<script>
  let ip = 'Loading...';

  async function getIp() {
    try {
      const response = await fetch('https://ip.isp.tools/json');
      const data = await response.json();
      ip = data.ip;
    } catch (error) {
      ip = 'Error fetching IP';
      console.error(error);
    }
  }

  getIp();
</script>

<h1>Your IP Address:</h1>
<p>{ip}</p>

				
			
				
					import requests

request = requests.get('https://ip.isp.tools/json').json()
ip = request['ip']
type_ip = request['type']
print(ip, type_ip)

				
			
				
					<?php
$data = json_decode(file_get_contents('https://ip.isp.tools/json'), true);
echo "IP: {$data['ip']} — Type: {$data['type']}\n";

				
			
				
					package main

import (
  "encoding/json"
  "fmt"
  "net/http"
)

func main() {
  resp, _ := http.Get("https://ip.isp.tools/json")
  defer resp.Body.Close()
  var d struct{ IP string }
  json.NewDecoder(resp.Body).Decode(&d)
  fmt.Println(d.IP)
}

				
			
				
					import java.net.http.*; import java.net.URI; import com.fasterxml.jackson.databind.*;

public class Main {
  public static void main(String[] args)throws Exception {
    String b = HttpClient.newHttpClient()
      .send(HttpRequest.newBuilder(URI.create("https://ip.isp.tools/json")).build(),
            HttpResponse.BodyHandlers.ofString())
      .body();
    System.out.println(new ObjectMapper()
      .readTree(b).get("ip").asText());
  }
}

				
			
				
					using System;
using System.Net.Http;
using System.Text.Json;
class Program {
  static async System.Threading.Tasks.Task Main() {
    var j = await new HttpClient()
      .GetStringAsync("https://ip.isp.tools/json");
    Console.WriteLine(
      JsonDocument.Parse(j)
        .RootElement.GetProperty("ip")
        .GetString()
    );
  }
}

				
			
				
					require 'net/http'
require 'json'

data = JSON.parse(Net::HTTP.get(URI('https://ip.isp.tools/json')))
puts data['ip']

				
			
				
					#!/bin/bash
ip=$(curl -s https://ip.isp.tools/json | jq -r .ip)
echo $ip

				
			
				
					$ip = (Invoke-RestMethod -Uri 'https://ip.isp.tools/json').ip
Write-Host $ip
				
			
				
					@echo off
for /f "tokens=2 delims=:" %%a in ('curl -s https://ip.isp.tools/json ^| findstr "ip"') do set IP=%%a
set IP=%IP:"=%
echo %IP%

				
			
				
					#!/bin/zsh
ip=$(curl -s https://ip.isp.tools/json | jq -r .ip)
echo $ip

				
			
				
					#!/usr/bin/swift
import Foundation

let url = URL(string: "https://ip.isp.tools/json")!
let data = try! Data(contentsOf: url)
let obj  = try! JSONSerialization.jsonObject(with: data) as! [String:Any]
print(obj["ip"] as! String)

				
			
				
					use reqwest::blocking::get;
use serde_json::Value;

fn main() {
    let resp = get("https://ip.isp.tools/json").unwrap().text().unwrap();
    let ip   = serde_json::from_str::<Value>(&resp).unwrap()["ip"].as_str().unwrap();
    println!("{}", ip);
}

				
			
				
					import 'dart:convert';
import 'dart:io';

void main() async {
  var resp = await HttpClient()
      .getUrl(Uri.parse('https://ip.isp.tools/json'))
      .then((r) => r.close())
      .then((r) => r.transform(utf8.decoder).join());
  print(json.decode(resp)['ip']);
}

				
			

ISP.Tools survives thanks to ads.

Consider disabling your ad blocker.
We promise not to be intrusive.

Cookie Consent

We use cookies to improve your experience on our site.

By using our site you consent to cookies. Learn more