{
  "id": 12949194,
  "title": "I Built a Tiny Calorie Calculator (and What the Numbers Taught Me)",
  "url": "https://urgent.news/2026/10/08/i-built-a-tiny-calorie-calculator-and-what-the-numbers-taught-me",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-08T20:43:17.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mikehassi96/i-built-a-tiny-calorie-calculator-and-what-the-numbers-taught-me-f4f"
  },
  "original_language": "en",
  "account": "I did not set out to build a health app. I simply wanted a concise weekend project, devoid of to-do lists, that could deliver real inputs, real math, and an answer I could validate against my own life. Thus, I crafted a compact calorie calculator using plain JavaScript, sans any framework or build step—just a form, a handful of inputs, and one function. The formula utilized The starting point for most calculators is the Mifflin-St Jeor equation, which estimates one's basal metabolic rate, approximately how many calories one's body burns while at rest.\n\nThe JavaScript code begins with the bmr function, which takes weight in kilograms, height in centimeters, age, and sex as inputs. It calculates the base metabolic rate by multiplying the weight by 10, height by 6.25, subtracting five times the age, and adding or subtracting 5 based on sex. The maintenance function then multiplies the bmrValue by an activity factor to provide an estimate for daily calorie maintenance, which helps maintain weight stability.\n\nTesting the calculator on myself, the initial bug was mine, not the code. I entered my height in the incorrect unit, yielding a value suitable for a small horse, prompting a moment of self-questioning. Upon rectifying this, the result indeed surprised me. My maintenance estimate was higher than anticipated, contrary to my initial assumption of needing to consume fewer calories. This revelation stemmed from an online calorie guide, highlighting the significant impact of the activity multiplier on the outcome—a change of several hundred calories, roughly equivalent to an entire meal. This discovery underscored the critical role the multiplier plays in determining daily caloric needs, far more than initially realized.\n\nThe formula, though comprising just ten lines of code, posed the greater challenge: honesty in inputting one's activity level. I contemplated how actively I was living my life on an average week, not my peak performance week. The takeaway was clear: presenting an estimate as a single, definitive number can be misleading. To improve, I plan to incorporate thorough unit tests for edge cases, inform users of potential errors when height is input in the wrong unit, and instead present a range rather than a single, definitive figure.\n\nDespite its simplicity, this project achieved its goal. I shipped a small tool, gained insight into the workings of a widely quoted equation, and adjusted my eating habits—this time, increasing rather than decreasing my caloric intake, an unexpected but welcome outcome. Have you ever developed a small tool that taught you more about yourself than you anticipated?",
  "summary": "I did not set out to build a health app. I just wanted a small weekend project that was not another to-do list — something with real inputs, real maths, and an answer I could actually check against my own life. So I built a tiny calorie calculator in plain JavaScript. No framework, no build step, just a form, a few inputs, and one function. The formula I used Most calculators start with the…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}