What is a grid?
A grid here is a flat rectangle pierced by a regular array of m × n equal square holes of edge a. The holes are separated by straight bars of width b, and a bar of the same width runs along all four outer edges. It is a plane region with holes, like a lattice or a grille, rather than a single polygon.
How to use it
Type the number of holes along the length m and along the width n (whole numbers from 1 to 1,000), the hole edge a and the bar width b. The perimeter counts the outer edge and the edges of every hole, and the outer perimeter alone is shown as well. The length unit is only a label: lengths come out in that unit and areas in its square. Each length you type must be from 0.000001 to 1,000,000,000 (a box that allows 0 also accepts 0), each area from 0.000000000001 to 1,000,000,000,000,000,000 and each angle greater than 0° and less than 180°; anything else, including text, is refused with a sentence that says why, and so is a set of values that cannot form the shape.
Derivation of the formulas
Along the length there are m holes and m + 1 bars, and along the width n holes and n + 1 bars, so the outer rectangle measures:
$$ c = m a + (m + 1) b, \qquad d = n a + (n + 1) b $$
The area of the bars is the outer rectangle less the m·n holes, and the whole boundary is the outer edge plus four edges a for every hole:
$$ A = c d - m n a^{2}, \qquad P = 2(c + d) + 4 a m n $$
The same area also follows bar by bar, with no subtraction (the page uses this form, which stays exact for very thin bars): m + 1 bars run the full width d, and between them m pieces of length a sit in each of the n + 1 cross bars:
$$ A = (m + 1)\, b\, d + m (n + 1)\, a b $$
Worked example
The page opens with holes along the length m = 4, holes along the width n = 3, hole edge a = 2, bar width b = 1. Then area A (bars only) ≈ 82; perimeter P (outer edge plus the edges of all holes) ≈ 142; outer length c ≈ 13; outer width d ≈ 10. Values are shown with up to six decimals; a value below 0.0000005 or of 10¹⁵ and more is shown as its plain 12-digit number instead.
Frequently asked questions
Why is the perimeter so large?
Every hole adds its own edge of length 4a to the boundary. With many small holes the edges of the holes can be much longer than the outer edge, which matters for anything measured along the edges, such as a seal or a coating.
Why does the unit not change the numbers?
The calculator does not convert between units. Every length is read in the unit you chose, so the unit only labels the results; areas come out in that unit squared.
How accurate are the results?
Results are accurate to at least 9 significant digits for ordinary inputs. When a result depends on the small difference of two nearly equal entries (closer than one part in a million), fewer digits are reliable.
References
H. S. M. Coxeter, Introduction to Geometry, 2nd edition, Wiley, 1969
D. Zwillinger (ed.), CRC Standard Mathematical Tables and Formulas, 33rd edition, CRC Press, 2018