Build a Printable Freelance Invoice Generator with Tax and Totals in One HTML File

Creates a single-file invoice maker with editable line items, tax and discount handling, saved client details, and a print-ready layout you can save as PDF. It works offline and needs no server.

You getThe complete HTML file in one code block, A 'How to use' list of 5 steps or fewer and A table of risks and missing information

The prompt

Prompt
Role: You are a senior front-end developer who builds small, dependable, offline business tools.

Context: I am a freelance graphic designer (example value for {business_type}) who needs to produce clean invoices quickly. The decision this tool supports is whether an invoice is accurate and ready to send, so totals must be trustworthy and easy to check. Currency is USD (example value for {currency}). Tax rule: 8.25% sales tax applied after discount, added on top of prices (example value for {tax_rule}). Accent color: #2f6fed (example value for {brand_color}).

Task: Build one self-contained HTML file (inline CSS and JavaScript, no external libraries, fonts or network calls) that works as an invoice generator.

Inputs (collect from my message; if any are missing, list them as assumptions before the code):
- Business name, address and payment instructions (fields the user can edit)
- Client name and address
- Invoice number, issue date, due date or payment terms
- Line items: description, quantity, unit price
- Tax rate and whether prices include tax
- Optional discount (percent or fixed) and optional notes

Workflow:
1. State assumptions separately in a short list (rounding method, tax applied after discount, date format).
2. Build the form with add/remove line items, live subtotal, discount, tax and total.
3. Round each line to 2 decimals and compute totals from rounded lines so the printed numbers add up.
4. Save business details and the last invoice number in localStorage; auto-increment the number on 'New invoice'.
5. Add a print stylesheet so the preview prints on A4 or Letter with no buttons or form chrome; the Print button calls window.print().
6. Validate: block printing with an inline message if the client name is empty, a quantity is not positive, or the due date is before the issue date.
7. Use the accent color for headings and the total row, and keep text contrast readable.

Constraints: No frameworks, no external requests, no tracking. Escape user text before inserting into HTML. Keyboard accessible with labeled inputs. Under 400 lines if possible. Do not claim the tool provides legal or tax advice.

Output format:
1. Assumptions (bullets)
2. The complete HTML file in one code block
3. A 'How to use' list of 5 steps or fewer
4. A table of risks and missing information (risk, impact, suggested next action)
5. Three next-action ideas such as CSV export or multi-currency support

Acceptance criteria:
- Totals match a hand calculation for a test invoice with 3 lines, a discount and tax
- The printed page shows only the invoice
- Data persists after refresh
- Invalid input shows a clear message instead of NaN

Quality checks: Before replying, mentally test one invoice with a quantity of 2.5 and a price of 19.99, a 10 percent discount and the stated tax rule. Confirm there are no undefined variables, that the file opens offline, and that every Acceptance criteria item is met. List any item you could not verify.

Dashed parts are example values, so the prompt runs as copied. Change them in Fill in the blanks.

Paste into any capable coding assistant and open the saved .html file in a browser. Adjust the tax rule to your own jurisdiction and have an accountant confirm invoice requirements before sending real invoices.

Make it repeatable

Keep using this prompt without pasting it in every time.

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

Keep exploring

More in Mini Apps & Tools