Invoice templates Free template
Printable invoice
An editable invoice page: add and remove lines, totals and tax update by themselves, and it prints cleanly as a one-page PDF.
The preview runs in a sandbox: it cannot reach your account, cookies or the network.
About this template
A professional invoice you edit directly in the browser. Click any text to change it, add or remove line items, set the tax rate and watch the subtotal, tax and total update. Use your browser's Print command (Save as PDF) to produce the final document; the print styles hide the buttons and controls. All amounts are calculated in whole cents to avoid rounding mistakes. For legally compliant invoices in your country check the local rules (tax numbers, wording).
Look under the hood
Included source files
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Invoice</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="tools">
<button type="button" id="add">Add line</button>
<label>Tax rate % <input id="rate" type="number" min="0" max="100" step="0.1" value="20"></label>
<button type="button" id="print">Print / Save as PDF</button>
</div>
<article class="sheet">
<header class="top">
<div>
<h1 contenteditable="true" spellcheck="false">Invoice</h1>
<p>No. <span contenteditable="true">INV-2026-001</span><br>Date: <span contenteditable="true">2026-11-06</span><br>Due: <span contenteditable="true">2026-11-20</span></p>
</div>
<div class="from">
<strong contenteditable="true" spellcheck="false">Your Company Ltd</strong>
<p contenteditable="true" spellcheck="false">12 Example Street<br>Lisbon, Portugal<br>VAT ID: PT123456789</p>
</div>
</header>
<section class="bill">
<h2>Bill to</h2>
<p contenteditable="true" spellcheck="false">Client Name<br>34 Sample Avenue<br>Porto, Portugal</p>
</section>
<table>
<thead><tr><th>Description</th><th class="num">Qty</th><th class="num">Unit price</th><th class="num">Amount</th><th class="noprint"></th></tr></thead>
<tbody id="lines"></tbody>
</table>
<dl class="totals">
<dt>Subtotal</dt><dd id="subtotal">0.00</dd>
<dt id="taxlabel">Tax</dt><dd id="tax">0.00</dd>
<dt class="grand">Total due</dt><dd id="total" class="grand">0.00</dd>
</dl>
<footer class="notes">
<h2>Payment details</h2>
<p contenteditable="true" spellcheck="false">Bank transfer to IBAN PT50 0000 0000 0000 0000 0000 0. Please quote the invoice number.</p>
</footer>
</article>
<script src="app.js"></script>
</body>
</html>
// All money is handled in whole cents (integers) so sums never show 0.1 + 0.2 style errors.
const lines = document.getElementById('lines');
const rate = document.getElementById('rate');
const toCents = (text) => Math.round(parseFloat(String(text).replace(/[^0-9.,-]/g, '').replace(',', '.')) * 100) || 0;
const format = (cents) => (cents / 100).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
function addLine(description = 'New item', qty = 1, price = '0.00') {
const tr = document.createElement('tr');
const cell = (text, editable, cls) => {
const td = document.createElement('td');
if (cls) td.className = cls;
const span = document.createElement('span');
span.className = 'cell';
span.textContent = text;
if (editable) {
span.contentEditable = 'true';
span.spellcheck = false;
span.addEventListener('input', recalculate);
}
td.append(span);
return td;
};
const remove = document.createElement('button');
remove.type = 'button';
remove.className = 'remove';
remove.textContent = '✕';
remove.setAttribute('aria-label', 'Remove this line');
remove.addEventListener('click', () => { tr.remove(); recalculate(); });
const last = document.createElement('td');
last.className = 'noprint';
last.append(remove);
tr.append(cell(description, true), cell(qty, true, 'num qty'), cell(price, true, 'num price'), cell('0.00', false, 'num amount'), last);
lines.append(tr);
recalculate();
}
function recalculate() {
let subtotal = 0;
lines.querySelectorAll('tr').forEach((tr) => {
const qty = parseFloat(tr.querySelector('.qty').textContent.replace(',', '.')) || 0;
const amount = Math.round(qty * toCents(tr.querySelector('.price').textContent));
tr.querySelector('.amount').firstChild.textContent = format(amount);
subtotal += amount;
});
const percent = parseFloat(rate.value) || 0;
const tax = Math.round(subtotal * percent / 100);
document.getElementById('subtotal').textContent = format(subtotal);
document.getElementById('taxlabel').textContent = 'Tax (' + percent + '%)';
document.getElementById('tax').textContent = format(tax);
document.getElementById('total').textContent = format(subtotal + tax);
}
document.getElementById('add').addEventListener('click', () => addLine());
document.getElementById('print').addEventListener('click', () => window.print());
rate.addEventListener('input', recalculate);
addLine('Website design', 1, '1200.00');
addLine('Hosting (12 months)', 12, '15.00');
addLine('Content writing (per page)', 5, '80.00');
* { box-sizing: border-box; }
body { margin: 0; padding: 1rem; background: #eceff1; font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; color: #141c20; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; max-width: 48rem; margin: 0 auto 1rem; }
.tools button { padding: 0.5rem 1rem; font: inherit; font-weight: 600; color: #fff; background: #c00000; border: 0; border-radius: 0.5rem; cursor: pointer; }
.tools input { width: 5rem; padding: 0.3rem; font: inherit; }
.sheet { max-width: 48rem; margin: 0 auto; padding: 2.5rem; background: #fff; box-shadow: 0 2px 12px rgb(0 0 0 / 0.12); }
.top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; }
h1 { margin: 0 0 0.5rem; font-size: 2rem; color: #c00000; }
h2 { margin: 1.5rem 0 0.3rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: #5a6670; }
.from { text-align: right; }
[contenteditable]:hover, [contenteditable]:focus { background: #fff8e1; outline: none; }
table { width: 100%; margin-top: 1.5rem; border-collapse: collapse; }
th { text-align: left; padding: 0.5rem; font-size: 0.8rem; text-transform: uppercase; color: #5a6670; border-bottom: 2px solid #141c20; }
td { padding: 0.5rem; border-bottom: 1px solid #e3e6e9; vertical-align: top; }
.num { text-align: right; white-space: nowrap; }
td .cell { display: block; min-width: 3rem; }
.remove { padding: 0 0.5rem; font: inherit; color: #a40000; background: none; border: 0; cursor: pointer; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 2rem; width: 18rem; margin: 1.5rem 0 0 auto; }
.totals dt, .totals dd { margin: 0; }
.totals dd { text-align: right; }
.grand { padding-top: 0.5rem; font-size: 1.2rem; font-weight: 700; border-top: 2px solid #141c20; }
.notes p { color: #5a6670; }
@media print {
body { padding: 0; background: #fff; }
.tools, .noprint { display: none !important; }
.sheet { max-width: none; padding: 0; box-shadow: none; }
[contenteditable]:hover { background: none; }
}
Update history
- 1.0.0
First release.