DevToolBox

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.1192.168.1.254
総アドレス数256
IPクラス(参考)C
アドレス種別プライベート (RFC1918)
2進数 (IPアドレス)11000000.10101000.00000001.00001010
2進数 (サブネットマスク)11111111.11111111.11111111.00000000

早見表(CIDR・サブネットマスク・ホスト数)

CIDRサブネットマスク総アドレス数使用可能ホスト数
/00.0.0.04,294,967,2964,294,967,294
/1128.0.0.02,147,483,6482,147,483,646
/2192.0.0.01,073,741,8241,073,741,822
/3224.0.0.0536,870,912536,870,910
/4240.0.0.0268,435,456268,435,454
/5248.0.0.0134,217,728134,217,726
/6252.0.0.067,108,86467,108,862
/7254.0.0.033,554,43233,554,430
/8255.0.0.016,777,21616,777,214
/9255.128.0.08,388,6088,388,606
/10255.192.0.04,194,3044,194,302
/11255.224.0.02,097,1522,097,150
/12255.240.0.01,048,5761,048,574
/13255.248.0.0524,288524,286
/14255.252.0.0262,144262,142
/15255.254.0.0131,072131,070
/16255.255.0.065,53665,534
/17255.255.128.032,76832,766
/18255.255.192.016,38416,382
/19255.255.224.08,1928,190
/20255.255.240.04,0964,094
/21255.255.248.02,0482,046
/22255.255.252.01,0241,022
/23255.255.254.0512510
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422
/32255.255.255.25511

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アドレスや算出結果が外部送信されることはありません。

開発をもっと効率的に

PR