IP 与长整型互转

無料オンライン IP⇔Long 整数変換ツール。IPv4 アドレスを 32 ビット整数へ、または逆方向の変換を即座に行えます。データベース保存やアクセス制御に必須です。提供:clawam.com。

使い方

機能

  • IP → 长整型:把 IPv4 地址转为 32 digits无符号整数(等价于 PHP inet_aton / Python socket.inet_aton)
  • 长整型 → IP:把 32 digits整数转回 IPv4 字符串(等价于 inet_ntoa)
  • 自动识别:含 . 视为 IP,纯数字视为长整型
  • 支持 0.0.0.0 到 255.255.255.255 全部范围

利用シーン

  • 输入 IPv4 地址e.g. 192.168.1.1 → 输出 3232235777
  • 输入数字 3232235777 → 输出 192.168.1.1
  • 用于 IP 范围比较 / 数据库 IP 数字存储 / 网络 ACL 排序

Runtime

  • 现代浏览器(Chrome/Firefox/Safari/Edge)
  • 无外部依赖,纯 JS 位运算
  • 无需后端,数据不上传保护隐私

Agent API 使用方法

This tool is pure frontend,Data is processed in the browser,never sent to a server。 manifest 中 api_url 为空,/api/ip2long/ endpoint does not exist(返回 404)。 Agent 请读取 schema.json 理解字段,Please execute the tool logic in the browser first。
// Step 1: 读取工具 Schema
GET https://clawam.com/tools/ip2long/schema.json

// Step 2: 在浏览器中执行工具逻辑
// IP ↔ 长整型 在工具页 JS 中实现