IP to Integer Converter
IPv4アドレスと32bit符号なし整数を双方向に変換。すべてブラウザ内で処理します。
How to Use
Select a direction, enter a dotted IPv4 address or an unsigned integer from 0 through 4294967295, and press Convert. Four octets from 0 through 255 are accepted.
32-bit representation
For a.b.c.d, calculate a × 256³ + b × 256² + c × 256 + d. This concatenates four 8-bit octets in network byte order (big-endian).
Unsigned JavaScript values
Bitwise operators coerce numbers to signed 32-bit integers and can return negative values. This tool uses exact multiplication and division instead.
Databases, logs, and ranges
Numeric addresses simplify indexed range queries, log analysis, and legacy integrations. For dual-stack systems, consider a native IP type that supports IPv6.
使い方
方向を選び、IPv4または0〜4294967295の整数を入力して変換します。
変換式と背景
各オクテットを8bitとして上位から連結します。逆変換は256の累乗による除算と剰余で各オクテットを復元します。
実務用途
データベースの数値インデックス、ログ解析、IPレンジ判定、整数形式を使うレガシーシステムとの連携に利用できます。IPv6は128bitのため対象外です。
よくあるエラーと対処 / Common Errors and Fixes
| 症状 / Symptom | 原因 / Cause | 対処 / Fix |
|---|---|---|
| IPv4形式エラー Invalid format | ドット不足・CIDR付き Missing dots or CIDR suffix | ドット区切り4項目のみ入力 Use four dotted octets |
| 範囲エラー Range error | オクテットが255超過 Octet above 255 | 各値を0〜255に修正 Keep each octet in range |
| 整数エラー Integer error | 負数・小数・上限超過 Negative, fraction, or too large | 0〜4294967295を使用 Use the supported range |
| 負数になる Negative result | 符号付きビット演算 Signed bitwise operation | 算術演算を使用 Use arithmetic |
言語別コード例 / Code Examples
JavaScript
const ipToInt = ip => ip.split('.').map(Number).reduce((n,o) => n*256+o, 0);
const intToIp = n => [24,16,8,0].map(s => Math.floor(n/2**s)%256).join('.');Python
def ip_to_int(ip):
return sum(int(x) << s for x, s in zip(ip.split('.'), (24,16,8,0)))
def int_to_ip(n):
return '.'.join(str((n >> s) & 255) for s in (24,16,8,0))Go
v := binary.BigEndian.Uint32(net.ParseIP(ip).To4())
b := make([]byte, 4)
binary.BigEndian.PutUint32(b, v)
ip := net.IP(b).String()Before / After 実例
192.168.1.1 → 3232235777
8.8.8.8 → 134744072
0.0.0.0 → 0
255.255.255.255 → 4294967295
2130706433 → 127.0.0.1192.168.1.1は16進数で0xC0A80101です。
Why browser-only? / なぜブラウザ完結か
IP addresses in logs and internal plans can reveal infrastructure. Local JavaScript performs all validation and conversion; no external API receives your data.
ログや社内ネットワークのIPは機密情報になり得ます。本ツールは外部APIを呼ばず、入力をサーバーへ送信しません。
関連ツール・関連ガイド
関連ツール / Related Tools
開発をもっと効率的に
PR
レンタルサーバー
エックスサーバー
国内シェアNo.1の高速レンタルサーバー(エックスサーバー社調べ)。WordPressも簡単セットアップ。
詳しく見る →レンタルサーバー
ConoHa WING
国内最速クラスのレンタルサーバー。独自ドメイン永久無料特典付き(特典内容は変更される場合があります)。
詳しく見る →レンタルサーバー
mixhost
高速SSD・HTTP/3対応のクラウド型レンタルサーバー。
詳しく見る →VPS
シンVPS
メモリ単価が国内最安水準・オールNVMe SSD搭載の高性能VPS(大容量メモリプラン利用時)。開発・検証環境の構築に。
詳しく見る →Windows VPS
ConoHa for Windows Server
Windows環境のVPS。リモートデスクトップで開発・検証環境を構築。
詳しく見る →