DEV Community

Find My Bra Size
Find My Bra Size

Posted on Originally published at bra-sizecalculator.com

How I built an accurate bra-size calculator in vanilla JavaScript (no backend)

Bra sizing math is deceptively simple on paper and surprisingly tricky in practice. Here's how I built a free, client-side bra size calculator (https://bra-sizecalculator.com/) that runs entirely in the browser — no backend, no database, no frameworks.

The core math is two measurements: underbust (for band) and overbust (for cup). Band size is the underbust rounded to the nearest even number (US/UK sizing); cup letter comes from the difference between overbust and band in inches: 1" = A, 2" = B, 3" = C, and so on. The tricky part is the edge cases: measuring between whole inches, sister sizes (34C ≈ 32D ≈ 36B), and the fact that most people wear the wrong band size, which throws the whole calculation off.

Implementation-wise, I kept it dependency-free: a single JS module takes the two inputs, sanitizes them (guarding against cm/inch mixups and absurd values like a 200-inch band), computes band and cup, and maps to a full sister-size grid. All computation happens in the browser, so there is no server round-trip and no measurement data ever leaves the device — which matters a lot for a tool people are understandably privacy-sensitive about.

A few lessons worth stealing for your own micro-tools:

  1. Validate at the boundary: reject impossible inputs before the math ever sees them.
  2. Round in the right place: band rounding must happen before the cup difference is computed, not after, or every letter shifts.
  3. Sister-size mapping is just a lookup table, but generating it programmatically from band/cup indices keeps it consistent across US, UK, and EU charts.

The calculator is live and free at https://bra-sizecalculator.com/ — try it, break it, and tell me which sizing edge case I missed.

Top comments (0)