Random Invoice Numbers: When to Use Them and When to Avoid Them
Invoicing Basics · 8 min read · September 2026
The short answer: a random invoice number such as INV-2026-483920 is unique, looks professional, and hides how many invoices you have issued. But most VAT and GST systems expect invoices to run in a sequence, so pure randomness can create an audit problem. The safest approach is a hybrid - a sequential series behind a random-looking prefix. You can build either one free in the invoice number generator.
What is a random invoice number?
A random invoice number is an invoice reference whose counter is generated at random instead of counting upwards. Rather than INV-0001, INV-0002, INV-0003, you get INV-483920, INV-107744, INV-920155 - no relationship between one number and the next.
It still does the basic job of an invoice number: it uniquely identifies one document, so you, your client and your accountant can all point at the same bill. What it loses is order - and order is what auditors use to prove nothing is missing.
Why people want random invoice numbers
- Hiding your invoice volume. This is the real reason, and it is a fair one. An invoice numbered
0002tells your client they are your second customer ever, which weakens your position on price and terms. - Client privacy. If two clients ever compare invoices, sequential numbers reveal roughly how much business you did between them.
- Harder to guess. If invoices are reachable through a web link or client portal, sequential IDs let anyone change
1042to1043and try their luck. Random references remove that temptation. - Avoiding collisions across systems. Teams issuing invoices from several devices sometimes reach for randomness to stop two people generating the same number.
The first three are legitimate. The fourth is a trap - randomness makes collisions less visible, not less likely, as the numbers below show.
The catch: most tax systems expect a sequence
Requirements differ by country, but the pattern is consistent - invoice numbers should be unique and sequential:
- UK and EU (VAT) - a VAT invoice must carry a sequential number, based on one or more series, that uniquely identifies the document. See the VAT invoice generator.
- India and Pakistan (GST) - GST invoices need a consecutive serial number, unique for the financial year. See the GST invoice generator.
- Australia (ABN) - a tax invoice needs an identifying number, and sequential numbering is standard practice. See the ABN invoice generator.
- United States - no federal numbering mandate, but the IRS expects complete, consistent records, and a sequence is the accepted way to show none are missing.
Rules change and vary by situation, so confirm your own position with your accountant or tax authority. The practical takeaway is the same everywhere: a purely random series makes it hard to prove no invoice is missing, because there is no expected "next" number.
The duplicate problem nobody mentions
Random invoice numbers collide much sooner than intuition suggests. This is the birthday problem: the question is not whether a new number matches one specific old number, but whether any two of your numbers match.
Here is the approximate chance that at least two of your invoices share a number:
| Invoices issued | 5-digit random | 6-digit random | 8-digit random |
|---|---|---|---|
| 100 | 5.4% | 0.6% | under 0.1% |
| 500 | 75% | 13% | 0.1% |
| 1,000 | 99.6% | 43% | 0.6% |
| 5,000 | over 99.9% | over 99.9% | 13% |
Read the middle column again: after 1,000 random six-digit invoices there is roughly a 43% chance two of them carry the same number. Two invoices sharing a reference is a real accounting problem - payments get matched to the wrong bill.
So if you do use random numbers: use at least six digits, eight if you invoice often, and always check a new number against those you have already issued.
The hybrid format most businesses should use
You can have the privacy of random numbers and the unbroken sequence auditors want. Keep the sequence; randomise the part that identifies the client.
- Random prefix, sequential counter -
7K2F-2026-001,7K2F-2026-002for one client,M91X-2026-001for another. Several billing platforms work this way, and it is what we would recommend to most freelancers. - High starting number - the simplest fix of all. Start at
1042instead of001and count up normally. Nobody can tell whether it is your first invoice or your thousandth, and your sequence stays perfect. - Internal sequence, public reference - if you run a portal or app, store the sequential number and show clients a random token instead. Developers usually arrive here after their first enumeration complaint.
For a full comparison of numbering systems, read invoice numbering best practices.
How to generate a random invoice number
1. With the free generator (fastest)
Open the invoice number generator, switch the mode to Random, set your prefix and digit length, and copy the result. You can generate a batch and download it as CSV if you need to reserve numbers in advance. It runs in your browser - nothing is sent to a server.
2. In Excel or Google Sheets
="INV-" & TEXT(YEAR(TODAY()),"0000") & "-" & TEXT(RANDBETWEEN(100000,999999),"000000")
That produces something like INV-2026-483920. One warning: RANDBETWEEN recalculates whenever the sheet changes, so the number will silently change after you have used it. Copy the cell and paste it back as a value.
3. In PHP
$number = sprintf('INV-%d-%06d', date('Y'), random_int(100000, 999999));
// Then confirm it is not already taken before saving it.
Use random_int() rather than rand() - it draws from a cryptographically secure source, so one number cannot be predicted from another.
4. In Python
import secrets, datetime
number = f"INV-{datetime.date.today().year}-{secrets.randbelow(900000) + 100000}"
In any language the uniqueness check matters more than the generator. If invoices live in a database, put a unique constraint on the number column and retry on conflict - that is the only way to be certain.
Random invoice number formats
| Format | Example | Best for |
|---|---|---|
| Random counter | INV-483920 | Low volume, no VAT/GST sequence duty |
| Year + random | INV-2026-483920 | Keeping tax years separate |
| Alphanumeric | INV-7K2F9X | More combinations in fewer characters |
| Random prefix + sequence | 7K2F-2026-014 | Most businesses - private and auditable |
| High start | INV-2026-1042 | New freelancers who want privacy and simplicity |
Mistakes to avoid
- Too few digits. Four-digit random numbers collide after roughly 100 invoices. Six is the minimum worth using.
- No uniqueness check. Random does not mean unique - verify against what you have already issued.
- Live spreadsheet formulas.
RANDBETWEENchanges the number after you have sent the invoice. Paste as a value. - Switching mid-year. Jumping from sequential to random halfway through a tax year makes records harder to explain, not easier.
- Using randomness to disguise gaps. If you cancelled an invoice, keep it on file marked cancelled.
Frequently asked questions
Can an invoice number be random?
Technically yes - the number only has to identify one document uniquely. But if you are VAT or GST registered, your numbers are expected to form a sequence, so a purely random series can create problems at audit even when every number is unique.
Is a random invoice number legal?
It depends where you are and whether you are registered for VAT or GST. In the UK and EU, VAT invoices must carry a sequential number; in India and Pakistan, GST invoices need a consecutive serial. In the US there is no federal rule. Check your own obligations with your accountant.
How many digits should a random invoice number have?
Six at minimum, eight if you invoice regularly. Six digits give 900,000 values, and after 1,000 invoices there is still roughly a 43% chance of a duplicate somewhere in your records.
How do I make a random invoice number in Excel?
Combine a prefix with TEXT(RANDBETWEEN(100000,999999),"000000"), then paste the result as a value so it stops recalculating.
What is the best alternative?
A sequential series that starts high (1042) or carries a random client prefix (7K2F-2026-014). You get the privacy you wanted and keep the sequence auditors expect.
Banana