Build a Restaurant Tip and Bill Splitter With Uneven Shares in One HTML File
A ready-to-paste prompt that builds a bill splitter where diners pay for what they ordered, tax and tip are shared fairly, totals round neatly, and every cent adds up.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
Act as a senior front-end developer who builds clean, practical web tools. Build "Fair Share", a restaurant tip and bill splitter for groups where people ordered different things, as one self-contained HTML page with no external libraries, storage or network calls. Inputs: food-and-drinks subtotal, tax, a tip picked from 15, 18, 20, 22 and 25% chips or typed as a custom percent, and a checkbox to tip on the pre-tax amount. A people list lets users add, rename and remove diners. Each diner is either Even or Custom, and Custom takes that person's pre-tax items. Rules:
1. Even diners split whatever subtotal remains. Tax and tip are shared in proportion to each person's food.
2. Rounding options: exact cents, total up to $1, total up to $5, or each person up to $1. Any extra cents go to the tip.
3. Do all math in integer cents. Use largest-remainder allocation so payments add up exactly to the total, and show a check line that confirms it.
4. Results panel: big grand total, a subtotal, tax, tip, rounding and total breakdown, the effective tip %, and a card for each person with amount, food, tax, tip and a proportional bar.
5. Show an inline warning, never an alert, if custom amounts exceed the subtotal. Update everything live.
6. Use two columns on desktop and stack them from 360px. Include labeled inputs, 44px touch targets, visible focus, a cream and deep green palette, and a prefilled four-person dinner.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Integer-cent math with largest-remainder allocation means the payments always add up to the exact total, with no stray penny.
- Giving custom diners their pre-tax items and splitting tax and tip by share matches how people actually think a fair split works.
- Inline warnings and live updates replace alerts and forms, so the page runs cleanly in sandboxed previews.
Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as fair-share.html and open it in any browser, or run it in the chat's canvas or preview pane. It works offline.
Common edits
- Change the currency symbol and tip presets, for example € with 5, 10 and 15% for European service norms.
- Add a per-person 'skip tip' toggle or a shared-appetizer line that is split only among selected diners.
Prompt details
- By
- Prompts-GPT editors
- Published
Keep exploring
More like this
Build a Countdown Timer to Any Date With a Confetti Finish in One HTML File
Get a polished single-file countdown page with a custom event title, a large days-hours-minutes-seconds display and a confetti-and-chime celebration at zero.
Build a Keyboard-Friendly To-Do Checklist with Priorities and Filters in One HTML File
A ready-to-paste prompt that makes an AI build a single-file to-do checklist where you can add, reorder, prioritize, filter and export tasks as plain text, all with keyboard shortcuts.
Build a Random Team Picker That Splits Names Into Fair Groups in One HTML File
You get a single-file team picker: paste names, choose a team count or team size, watch an animated shuffle deal everyone into evenly sized teams, then reshuffle with one key.
Build a Strong Password Generator with Strength Meter in One HTML File
You get a single HTML file that makes cryptographically random passwords, with toggles for character sets, an entropy-based strength meter and one-click copy.
Build an Instant Two-Way Unit Converter With Kitchen Measurements in HTML
A prompt that produces a single-file unit converter for length, weight, temperature, volume and cooking that updates both directions as you type, including cups-to-grams by ingredient.
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.