CIDR Calculator(IPv4サブネット計算)
IPアドレスとCIDR表記(例: 192.168.1.0/24)からネットワークアドレス・ブロードキャストアドレス・サブネットマスク・使用可能ホスト数を計算します。必要ホスト数からCIDRを逆算するモードつき。
「192.168.1.0/24」のようにCIDR表記のまま貼り付けても自動認識します。
計算結果
| 入力 | 192.168.1.10/24 |
|---|---|
| ネットワークアドレス | 192.168.1.0 |
| ブロードキャストアドレス | 192.168.1.255 |
| サブネットマスク | 255.255.255.0 (/24) |
| ワイルドカードマスク | 0.0.0.255 |
| 使用可能ホスト数 | 254 |
| 使用可能ホスト範囲 | 192.168.1.1 〜 192.168.1.254 |
| 総アドレス数 | 256 |
| IPクラス(参考) | C |
| アドレス種別 | プライベート (RFC1918) |
| 2進数 (IPアドレス) | 11000000.10101000.00000001.00001010 |
| 2進数 (サブネットマスク) | 11111111.11111111.11111111.00000000 |
早見表(CIDR・サブネットマスク・ホスト数)
| CIDR | サブネットマスク | 総アドレス数 | 使用可能ホスト数 |
|---|---|---|---|
| /0 | 0.0.0.0 | 4,294,967,296 | 4,294,967,294 |
| /1 | 128.0.0.0 | 2,147,483,648 | 2,147,483,646 |
| /2 | 192.0.0.0 | 1,073,741,824 | 1,073,741,822 |
| /3 | 224.0.0.0 | 536,870,912 | 536,870,910 |
| /4 | 240.0.0.0 | 268,435,456 | 268,435,454 |
| /5 | 248.0.0.0 | 134,217,728 | 134,217,726 |
| /6 | 252.0.0.0 | 67,108,864 | 67,108,862 |
| /7 | 254.0.0.0 | 33,554,432 | 33,554,430 |
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /17 | 255.255.128.0 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 |
| /32 | 255.255.255.255 | 1 | 1 |
How to Use the CIDR Calculator
Enter an IPv4 address and a prefix length (CIDR notation, e.g. 192.168.1.0/24) to instantly calculate the network address, broadcast address, subnet mask, wildcard mask, usable host range and total address count. You can paste a full CIDR string directly into the IP field and it will be split automatically. Switch to "Hosts → CIDR" mode to work backwards: enter how many hosts you need, and the tool suggests the smallest subnet (largest prefix) that fits.
Features
- Network address, broadcast address, subnet mask and wildcard mask
- Usable host count and first/last usable host address
- Special-cased /31 (point-to-point, RFC 3021) and /32 (single host) handling
- Reverse lookup: required host count → recommended CIDR prefix
- Full /0–/32 reference table and binary representation of the address and mask
- Runs entirely client-side — no IP address or network layout is ever uploaded
CIDR Calculatorの使い方
IPアドレスとプレフィックス長(CIDR表記、例: 192.168.1.0/24)を入力すると、ネットワークアドレス・ ブロードキャストアドレス・サブネットマスク・ワイルドカードマスク・使用可能ホスト範囲・総アドレス数が 即座に計算されます。IPアドレス欄には「192.168.1.0/24」のようにCIDR表記のまま貼り付けても自動的に 分割されます。「必要ホスト数 → CIDR」タブでは、逆に必要な台数を入力するだけで収まる最小のサブネット (最大のプレフィックス長)を提案します。
ネットワークエンジニアリングでの主な用途
- サブネット設計 -- VLANやオンプレミス/クラウドのサブネットを何台分確保すればよいか逆算
- ファイアウォール・ACL設定の確認 -- 許可/拒否ルールに指定されたCIDRが実際にどの範囲を指すかを検証
- IPアドレス設計の見直し -- 既存ネットワークのアドレス使用効率(使用可能ホスト数に対する実利用台数)を確認
よくある落とし穴と対処 / Common Pitfalls
| 落とし穴 / Pitfall | 問題 / Problem | 対処 / Fix |
|---|---|---|
| ネットワーク/ブロードキャストアドレスを機器に割り当てる Assigning the network/broadcast address to a device | /24なら.0と.255は特殊用途で、通常のホストには使えない The all-zero and all-one host addresses are reserved, not assignable | 「使用可能ホスト範囲」に表示された範囲内のみ使用する Only assign addresses within the "usable host range" |
| /31・/32を通常のサブネットと同じ感覚で扱う Treating /31 and /32 like a normal subnet | /31はポイントツーポイント回線用(RFC3021)で両アドレスとも使用可、/32は単一ホスト経路用でネットワーク/ブロードキャストの概念がない /31 is for point-to-point links (both addresses usable); /32 identifies a single host | ルーター間リンクは/31、ループバックやホスト経路は/32を検討する Use /31 for router links, /32 for loopbacks or host routes |
| プレフィックス長とサブネットマスクを混同する Confusing prefix length with the mask itself | 「/24」は24ビット分のマスクを意味し、24.0.0.0のような値ではない /24 means 24 mask bits, not the literal value 24.0.0.0 | 早見表でプレフィックスと実際のサブネットマスク値を対応付けて確認する Cross-check the prefix against the reference table's mask column |
| IPクラス(クラスフルアドレッシング)が今も有効だと誤解する Assuming classful addressing (Class A/B/C) still governs routing | 1993年のCIDR導入以降、実運用はクラスに関係なく任意のプレフィックス長を使う CIDR (1993) replaced classful routing; any prefix length can be used regardless of class | 本ツールのIPクラス表示は参考情報として扱い、設計はCIDRベースで行う Treat the IP class field as informational only; design subnets using CIDR |
| プライベートIPアドレスをそのままインターネットにルーティングしようとする Trying to route a private IP address on the public internet | 10.0.0.0/8・172.16.0.0/12・192.168.0.0/16(RFC1918)はグローバルに到達不可 RFC1918 ranges are not globally routable | 外部公開が必要な機器にはグローバルIPまたはNAT/リバースプロキシを使う Use a global IP, NAT, or reverse proxy for internet-facing hosts |
言語別コード例 / Code Examples
Python (ipaddress)
import ipaddress
net = ipaddress.ip_network("192.168.1.0/24", strict=False)
net.network_address # 192.168.1.0
net.broadcast_address # 192.168.1.255
net.netmask # 255.255.255.0
net.num_addresses - 2 # 使用可能ホスト数(254)JavaScript(本ツールと同じ考え方の最小実装)
const toInt = (ip) => ip.split(".").reduce((acc, o) => acc * 256 + Number(o), 0) >>> 0;
const mask = (prefix) => (prefix === 0 ? 0 : (0xffffffff << (32 - prefix)) >>> 0);
const network = (ipInt, maskInt) => (ipInt & maskInt) >>> 0;Shell(ipcalc)
ipcalc 192.168.1.0/24
# Address: 192.168.1.0
# Netmask: 255.255.255.0 = 24
# HostMin: 192.168.1.1
# HostMax: 192.168.1.254
# Broadcast: 192.168.1.255計算例 / Before & After
入力: 192.168.1.10/24
→ ネットワーク: 192.168.1.0 ブロードキャスト: 192.168.1.255
→ サブネットマスク: 255.255.255.0
→ 使用可能ホスト: 192.168.1.1 〜 192.168.1.254 (254台)
入力: 10.0.5.130/26
→ ネットワーク: 10.0.5.128 ブロードキャスト: 10.0.5.191
→ 使用可能ホスト: 10.0.5.129 〜 10.0.5.190 (62台)
必要ホスト数: 500 → 推奨CIDR: /23 (使用可能ホスト510台、255.254.0.0)Why browser-only?
The IP addresses you plug into a subnet calculator often describe your actual internal network layout — office LANs, VPC CIDR blocks, firewall rules. This tool computes everything with plain JavaScript bitwise operations entirely in your browser: no address, prefix, or derived range is ever sent anywhere. Check the DevTools Network tab yourself — it stays empty while you calculate.
サブネット計算に入力するIPアドレスは、社内LANやクラウドのVPC CIDR、ファイアウォールルールなど 実際のネットワーク構成を反映していることがほとんどです。本ツールはビット演算による計算を全てブラウザ内で 完結させており、入力したIPアドレスや算出結果が外部送信されることはありません。
関連ツール / Related Tools
開発をもっと効率的に
PR