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

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

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

Example: Fair Share, a tip and bill splitter for uneven orders.

The page opens with a $186.40 dinner for four. Maya and Priya entered their own items and Jonah and Theo split the rest. With a 20% tip rounded up to $1, the total is $240.00: Maya pays $74.94, Jonah and Theo pay $62.25 each, and Priya pays $40.56. Try switching to Each person to $1, toggling someone to Custom, or typing an 18.5% tip.

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

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

Did this prompt work?

Keep exploring

More in Mini Apps & Tools