Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 2 min read

The math behind a tile calculator (and why 10% extra is not always enough)

"How many tiles do I need?" sounds like one division. It is, until you try to answer it well enough that someone can take the number to a tile shop. Here is the math I ended up with while building Quick Tile Calculator,

"How many tiles do I need?" sounds like one division. It is, until you try to answer it well enough that someone can take the number to a tile shop. Here is the math I ended up with while building Quick Tile Calculator, a small free tool for floors, walls and showers.

1. Count the grout joint

Most calculators divide the room by the tile's face size. But every tile also takes up half a joint on each side, so the space one tile really covers is:

const pitch = (a + joint) * (b + joint); // a, b and joint in inches

For a 12 Γ— 24 in tile with a 1/8 in joint that is 12.125 Γ— 24.125 = 292.5 sq in, or 2.03 sq ft instead of 2. It sounds tiny, but on big rooms of small tile (3 Γ— 6 subway, mosaics) the joint is a real share of the wall.

2. Round up, then add extra

function tilesToBuy(areaSqIn, a, b, joint, extraPct) {
  const pitch = (a + joint) * (b + joint);
  const cover = Math.ceil(areaSqIn / pitch - 1e-9);   // tiles that cover the area
  const extra = Math.ceil(cover * extraPct / 100 - 1e-9);
  return { cover, extra, buy: cover + extra };
}

tilesToBuy(120 * 144, 12, 24, 0.125, 10); // 10 Γ— 12 ft floor -> { cover: 60, extra: 6, buy: 66 }

The - 1e-9 is there because floating point loves to turn an exact 60 into 60.00000000001, and Math.ceil would happily make that 61.

3. The extra depends on the layout

Extra is for tiles you cut along the walls (the offcut is often too small to reuse) and for breakage. How many tiles get cut depends on the pattern. I drew the same 10 Γ— 12 ft floor in 12 Γ— 24 in tile four ways and counted:

Layout Pieces cut at the edges Extra Tiles to buy
Straight 15 10% 66
Brick (offset) 21 10% 66
Diagonal 40 15% 69
Herringbone 37 15% 69

That matches the usual trade advice: about 10% for straight or brick, 15% for diagonal or herringbone, more for small rooms with lots of corners.

4. When a percentage is not enough

A flat percentage breaks down when tiles are large and the room is small. A 2 Γ— 2.5 m bathroom in 60 Γ— 120 cm tile is covered by 7 tiles, and 10% extra says buy 8. But almost every tile in that room touches a wall, and one big tile cannot always give you two usable edge pieces.

So for straight layouts the calculator also counts whole tiles the way an installer would: full rows and columns, then how many edge strips can come out of one tile (floor(tileWidth / leftoverWidth)), plus one for the corner. If that count is higher than the percentage, it shows the higher number. For the small bathroom above it says 10, not 8.

5. People buy boxes, not tiles

The last step is the one people actually need: divide by the tiles per box (or the area per box) printed on the label and round up again. 66 tiles at 8 per box is 9 boxes, 72 tiles.

What I learned

  • Put the joint in the math; it changes answers for small tile.
  • Always show the split ("60 to cover + 6 extra") so people can sanity-check it.
  • Ask only for numbers that are printed on the product. Guessing the box size made the first version of my headline number wrong.
  • A to-scale drawing of whole vs. cut tiles explains the extra better than any paragraph.

You can try it with your own room at quicktilecalculator.com. It supports feet and inches or metres, several areas, doors and windows, and the four layouts above.

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.