Build the calculator entirely in the browser: parse an IPv4 address and explicit CIDR prefix, derive the mask and network with exact 32-bit arithmetic, then convert the results back to dotted decimal. Local calculation can keep the address out of a calculation server request, but “zero-knowledge” is not a security guarantee by itself; the page’s scripts, analytics, hosting, and URL behavior also matter.
What the calculator needs to calculate
An IPv4 address is 32 bits, conventionally written as four decimal octets. CIDR writes the prefix length after a slash: for example, 192.168.1.130/24. The prefix says how many leading bits identify the network; the remaining bits are the host portion. RFC 4632 describes classless addressing and examples including 172.16.0.0/16 and 192.168.99.0/24. Do not infer a prefix from historical Class A, B, or C ranges; the prefix must be supplied explicitly.
As an Amazon Associate I earn from qualifying purchases.
For prefix p, the mask is p one-bits followed by 32−p zero-bits. Bitwise AND of the address and mask gives the network address. Clearing the network bits gives the host portion. The valid prefix range is 0 through 32, inclusive: /0 has no network bits and /32 has no host bits.
Recommended Free Tools
Parse and validate the input
Accept exactly four decimal octets separated by three dots, and a separate explicit prefix from 0 to 32. Reject malformed input rather than trying to repair or reinterpret it. This strict validation is an implementation choice; the four-octet address form comes from the IPv4 specification, RFC 791.
#1 Best Overall
- MACHINIST-SPECIFIC KEYS: Enter details for the job quickly and effectively without tedious and error-prone long hand calculations; The dedicated function keys let you scroll through the results to solve your speed and feed calculations for face, end or slot milling plus turning, drilling and boring
- BUILT-IN MATERIALS, PROCESSES AND TOOLS: Customize calculations specifically for a project without time-consuming drill and thread chart look-ups; helps with the cutting angle of drill points, enables you to select your tool based on type of material making for better results, longer tool life and more precise speeds and feeds
- BUILT-IN TABLES: Save you time from looking up information on distant charts, handbooks or on the internet for your most needed calculations; 20 common materials, 6 processes and 3 tools are included to handle the math for milling, turning, boring and drilling; spindle speed (rpm), feed rate (IPM), cut speeds, chip-load. Also solves bolt pattern layouts, 3-wire measurements and more
- EASY TO USE SOLUTIONS: Resolve common challenges faced by pros; dimensional math and unit conversions including a handy mils key, Plus right triangles, angles and trig. Built-in answers provide the recommended settings for machinery but also provide minimum and maximum guides so you can use what works for your project or go by the handbook
- COMPLETE PACKAGE INCLUDED: Comes with a rugged shock, dust and moisture-resistant Armadillo gear protective case, quick reference guide and complete users guide, and a long-life battery
- Reject missing or extra octets, non-decimal characters, and octet values outside 0–255.
- Reject a missing prefix or a prefix outside 0–32.
- Do not guess a prefix from the address’s first octet or legacy address class.
Implement the calculator
This function keeps the address, mask, and bitwise operations as BigInt values. Its output includes the dotted-decimal mask, network address, host portion, broadcast address, and the block size. JavaScript’s BigInt supports exact integer arithmetic beyond the precision range of Number; the two types have distinct rules and should not be mixed implicitly. See MDN’s BigInt documentation.
const MAX32 = (1n << 32n) - 1n;
function parseIPv4(text) {
const parts = text.split(".");
if (parts.length !== 4 || parts.some(part => !/^d+$/.test(part))) {
throw new Error("Enter four decimal octets, such as 192.168.1.130.");
}
const octets = parts.map(Number);
if (octets.some(octet => octet < 0 || octet > 255)) {
throw new Error("Each octet must be from 0 through 255.");
}
return octets.reduce((value, octet) => (value << 8n) | BigInt(octet), 0n);
}
function toIPv4(value) {
return [24n, 16n, 8n, 0n]
.map(shift => Number((value >> shift) & 255n))
.join(".");
}
function calculateSubnet(addressText, prefixText) {
if (!/^d+$/.test(prefixText)) {
throw new Error("Enter a CIDR prefix from 0 through 32.");
}
const prefix = Number(prefixText);
if (!Number.isInteger(prefix) || prefix < 0 || prefix > 32) {
throw new Error("Enter a CIDR prefix from 0 through 32.");
}
const address = parseIPv4(addressText);
const mask = prefix === 0 ? 0n : (MAX32 << BigInt(32 - prefix)) & MAX32;
const network = address & mask;
const host = address & (MAX32 ^ mask);
const blockSize = 1n << BigInt(32 - prefix);
const broadcast = network | (blockSize - 1n);
return {
prefix,
mask: toIPv4(mask),
network: toIPv4(network),
host: toIPv4(host),
blockSize: blockSize.toString(),
broadcast: toIPv4(broadcast)
};
}
The mask expression shifts a 32-bit all-ones value left by the number of host bits and clips the result back to 32 bits. The explicit /0 branch avoids relying on a shift edge case; for /32, the shift is zero and the result is all ones. The block size is 232−prefix. The network is the address with host bits cleared, and the broadcast address is the last address in that block.
Rank #2
- WORKS IN UNITS THAT WORK FOR YOU -- enter dimensions directly in feet, inches, fractions, yards and meters including square and cubic formats and then instantly convert to any standard building unit you prefer for consistent solutions that makes sense to you
- SET A PROJECT’S MATERIAL REQUIREMENTS to define and use stored values for estimating, including custom tile size, grout gaps, board widths, fence post spacing, paint coverage and more so you can quickly determine your material requirements and costs
- BUILT-IN FUNCTION KEYS help you easily find the number of boards or posts based on standard board lengths and stored measurements, so you get the fencing or decking material quantities you need to finish the job without costly overages or underages
- FIGURE OUT FLOORING REQUIREMENTS with built-in standard carpet roll lengths, linoleum square and roll sizes, custom tile sizes with various grout widths to quickly calculate coverage area and square yards you need based on an entered or calculated floor area
- Works directly in yards, feet, inches, fractions and meters – including square and cubic formats. No need to convert to decimals.
Present ranges without overstating usability
Label the broadcast address as a calculated range endpoint, not as a promise that every address in a block is usable on a real network. Many familiar IPv4 subnet conventions treat the first address as the network identifier and the last as broadcast, with addresses between them usable for hosts. That convention is not universal across prefix sizes or operational contexts: in particular, /31 and /32 require care. RFC 4632 addresses CIDR and routing, not every local assignment policy. If the tool displays a “usable host range,” document the convention it uses and verify that convention for the intended environment rather than presenting it as universal.
Free tools Windows power users keep installed
One-click scans. No signup required.
Verify boundary cases and examples
Use deterministic cases to check the arithmetic and validation behavior before presenting results to users. These expected values follow from the definitions; they are not a claim that this example has been independently tested.
Rank #3
- SOLVE ALL FRACTIONS EASILY: Calculate in multiple formats so you can calculate actual measurements with plan requirements and determine the new work piece size; work in standard fractions or figure out proper fractions, or determine mixed number and improper fractions; depending on your work requirement you can convert between decimal and fraction display results
- GET ANSWERS TO APPLIED MATH: Solve problems and convert between Imperial and metric units to make calculations straightforward; perform critical unit conversions when you have a plan marked in Imperial measurements and your work material is in metric; you can enter math equations using order of operations to get the right answer no matter the project
- TRIG FUNCTIONS GET STRAIGHT TO THE ANSWER: Solve angle and side problems; use dedicated keys to enter and solve circle, arc, radius hexagonal and polygonal dimensions; you just need to know your project's measurements, the calculator handles the relationship between particular quantities and units and also solves proportions and ratios
- HELPS YOU PREVENT COSTLY MATERIAL WASTE: Built-in solutions for welding, metal fabrication, engineering, drafting and more; you can also determine lengths, weights, angles and board feet totals for your material order requirements; the calculator minimizes the math, helping you get the answer you need for your work without fighting through equations
- DURABLE AND CONVENIENT DESIGN: Comes with a protective slide cover, quick reference and pocket reference guide that stores in calculator, one long-life battery; reduces headaches, saves time and prevents expensive material errors on all your projects, from the office to the shop floor or in the field
| Input | Expected mask | Expected network | What it checks |
|---|---|---|---|
192.168.1.130/24 |
255.255.255.0 |
192.168.1.0 |
Common octet-aligned prefix |
10.0.0.1/8 |
255.0.0.0 |
10.0.0.0 |
Network boundary at the first octet |
192.168.1.130/19 |
255.255.224.0 |
192.168.0.0 |
Prefix bits crossing an octet boundary |
203.0.113.7/0 |
0.0.0.0 |
0.0.0.0 |
No network bits; all address bits are host bits |
203.0.113.7/32 |
255.255.255.255 |
203.0.113.7 |
All address bits are prefix bits |
Also test invalid prefixes such as -1 and 33, malformed addresses, extra components, and octets above 255. If you add a usable-host output, test its policy separately for /31 and /32.
What “zero-knowledge” can honestly mean
A browser-only calculation means the arithmetic happens on the user’s device. It does not prove that the entered address is invisible to every other part of the page. Directly included third-party scripts can access other scripts and data on the page, and analytics, server requests, browser persistence, or query strings can expose inputs. MDN’s guidance on privacy on the web recommends minimizing collected data and managing third-party resources.
Rank #4
- ENTER DIMENSIONS JUST LIKE YOU SAY THEM: Input measurements directly in feet, inches, building fractions, decimals, yards and meters, including square areas and cubic volumes; one key instantly converts your measurements into all standard Imperial or metric math dimensions that work best for you and the project you are working on
- DEDICATED BUILDING FUNCTION KEYS: Make determining your project needs easy; just input project measurements, select material type like wallpaper, paint or tile; then calculate the quantity needed and total costs to avoid surprises at the homecenter checkout
- ACCURATE MATERIAL ESTIMATION: Helps you estimate material quantities and costs for your projects, ensuring you never buy too much or too little material; simplifies your home improvement and decorating jobs and cuts down on the number of trips to the hardware store
- PRECISE PAINT CALCULATIONS: Calculate exactly how much paint you need to ensure you finish the job without finding yourself with a half-painted room at night with a wet paint roller, and avoid storing or disposing of excess paint
- 11 BUILT-IN TILE SIZES: Make it easy to estimate the quantity needed to complete your project; simply calculate your square footage, then determine the tile required based on tile size and compare tile usage and costs by size; comes complete with hard cover, easy-to-follow user's guide, long-life battery and 1-year warranty
- Keep the address and prefix in memory; do not put them in the URL or persist them unless necessary and clearly disclosed.
- Do not include the inputs in analytics events, error reports, or server requests.
- Review the deployed page’s scripts and network behavior, especially third-party resources, before making a privacy claim.
Only after checking the actual deployed page can an operator accurately say: “The subnet calculation runs in your browser; the address you enter is not sent to our server for calculation.” That describes a specific data flow, not a cryptographic zero-knowledge proof. RFC 1918 defines private IPv4 address allocation, but private-address status does not change how this calculator parses or computes a prefix.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
Best Value
- Easy to use pre-programmed functions for trade specific calculations
- Provides material estimates for concrete, block, gravel, deck, fence, studs, flooring and paint
- Calculate accurate dimensions for perimeter, area, volume and weight measurements
- Oversized easy to read LCD display
- Easily convert between building dimensions in both English and Metric
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




