DEV Community

Dev Nestio
Dev Nestio

Posted on

Percentage Calculator — 6 Modes for Every Percent Math Problem

Overview

Percentage Calculator solves six distinct percentage problems in one browser-only tool.

🔗 https://devnestio.pages.dev/percent-calc/

The 6 modes

Mode Example
X% of Y 15% of 200 = 30
X is what % of Y 30 is what % of 200 = 15%
% Change 80 → 100 = +25%
Add % 100 + 20% = 120 (price + tax)
Subtract % 100 − 20% = 80 (price − discount)
Tip Calculator $85 + 18% ÷ 2 people = $50.15 each

Tech highlights

  • Instant result on every keystroke
  • Formula shown alongside result so you can verify the math
  • % Change uses Math.abs(from) as denominator — correctly handles negative bases
  • Tip mode shows tip amount, total, and per-person split simultaneously
  • Results formatted with up to 4 decimal places, trailing zeros stripped

👉 Try it: https://devnestio.pages.dev/percent-calc/

Top comments (0)