Your public IP, instantly
$
Multiple response formats for your needs
ipaddress.sh
208.80.152.201
ipaddress.sh?format=json
{"ip":"208.80.152.201"}
ipaddress.sh?format=jsonp
callback({"ip":"208.80.152.201"});
ipaddress.sh?format=jsonp&callback=getip
getip({"ip":"208.80.152.201"});
Get started in your favorite language
curl https://ipaddress.sh
wget -qO- https://ipaddress.sh
import requests
response = requests.get('https://ipaddress.sh')
ip_address = response.text
print("Your IP address is:", ip_address)
const response = await fetch('https://ipaddress.sh');
const ipAddress = await response.text();
console.log("Your IP address is:", ipAddress);
const response = await fetch('https://ipaddress.sh');
const ipAddress = await response.text();
console.log("Your IP address is:", ipAddress);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
resp, err := http.Get("https://ipaddress.sh")
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
ipAddress, _ := io.ReadAll(resp.Body)
fmt.Println("Your IP address is:", string(ipAddress))
}
use reqwest::Error;
#[tokio::main]
async fn main() -> Result<(), Error> {
let ip_address = reqwest::get("https://ipaddress.sh")
.await?
.text()
.await?;
println!("Your IP address is: {}", ip_address);
Ok(())
}
require 'net/http'
response = Net::HTTP.get(URI('https://ipaddress.sh'))
puts "Your IP address is: #{response}"
<?php
$ip_address = file_get_contents('https://ipaddress.sh');
echo "Your IP address is: " . $ip_address;
?>
import java.net.http.*;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://ipaddress.sh"))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println("Your IP address is: " + response.body());
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main() {
using var client = new HttpClient();
string ipAddress = await client.GetStringAsync("https://ipaddress.sh");
Console.WriteLine("Your IP address is: " + ipAddress);
}
}
import Foundation
let url = URL(string: "https://ipaddress.sh")!
let task = URLSession.shared.dataTask(with: url) { data, _, error in
guard let data = data, error == nil else { return }
let ipAddress = String(data: data, encoding: .utf8)
print("Your IP address is: \(ipAddress ?? "")")
}
task.resume()
import io.ktor.client.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import kotlinx.coroutines.runBlocking
fun main() = runBlocking {
val client = HttpClient()
val ipAddress = client.get("https://ipaddress.sh").bodyAsText()
println("Your IP address is: $ipAddress")
client.close()
}