Build a BMI and Daily Calorie Calculator with Metric and Imperial Units in HTML

A prompt that makes an AI build Steady Scale, a single-file BMI and calorie calculator using Mifflin-St Jeor, activity levels, unit switching and plain-language ranges.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
Act as a front-end developer who builds clean, trustworthy health utilities.

Build Steady Scale, a BMI and daily calorie needs calculator, as one self-contained HTML file with inline CSS and JavaScript. Use no external resources, storage, forms or alerts.

Inputs: a Metric/Imperial toggle (cm and kg, or feet, inches and pounds), the sex used by the formula, age, height, weight, and five activity levels from sedentary (1.2) to extra active (1.9). Give each activity level a one-line description.

Rules:
1. Results update live as the user types. Switching units converts the current values instead of clearing them.
2. Show BMI to one decimal with a color-banded bar from 15 to 40 and a moving marker. Use neutral, non-medical labels: below, within, above, and well above the usual range. Also show the healthy-weight range for the user's height in the chosen units.
3. Use Mifflin-St Jeor for resting energy, then multiply by the activity factor for maintenance. List gentle loss, steady loss, maintain and gentle gain targets, rounded to 10 kcal. Flag any target below the resting estimate.
4. Validate ages 18-90 and sensible height and weight ranges, and show a friendly inline message when an entry is out of range.
5. Layout: two-column cards above 820px wide, stacked below. Use a warm off-white background and one teal accent. Include labeled inputs, visible focus rings and aria-live results, and avoid big motion under prefers-reduced-motion.
6. End with a short plain-language legend and a clear note that this is educational, not medical advice.

Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Steady Scale, a live BMI and daily calorie calculator.

Choose Metric or Imperial and pick the sex used by the formula. Then enter your age, height and weight and choose an activity level. Your BMI appears on a color-banded bar with a plain-language label and your healthy-weight range. Below it, you get resting and maintenance calories plus four gentle goal targets. Try switching units to watch your values convert, or enter an out-of-range age to see the inline validation message.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Naming the exact formula, activity factors and rounding rules gives every model the same math, so the numbers come out consistent.
  • Requiring live updates and unit conversion on toggle avoids the usual submit button and form-reset bugs.
  • Neutral range labels plus a fixed disclaimer keep the tool helpful without sounding like a diagnosis.

Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as steady-scale.html and open it in any browser, or view it in the chat's preview or canvas panel.

Common edits

  • Change the accent color, app name or goal deficits (for example ±300 kcal) by editing the matching line in the prompt.
  • Ask for a macro split (protein, carbs, fat) under the maintenance figure, or a printable summary card.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Mini Apps & Tools