UK Company Registration Numbers: Format and Prefixes Explained

Reference · November 2026 · 9 min read

Eight characters, every Companies House prefix from SC and NI to OC, SO and R0, the leading-zero bug that corrupts company data, how it differs from a VAT number and a UTR, and how to use company numbers in test data.

Every company, LLP and limited partnership registered in the United Kingdom has a company registration number issued by Companies House. It is eight characters, it never changes, and a two-letter prefix says which register the entity sits on and what kind of entity it is. This guide covers the format, every prefix Companies House documents, the leading-zero bug that corrupts more company data than anything else, and how to use company numbers safely in forms and test data.

The format

A company registration number, also written CRN or just "company number", is always eight characters:

The number is assigned on incorporation and stays with the entity for life, through name changes, changes of address and changes of ownership. It appears on the certificate of incorporation, on the public register, and, by law, on the company's letterhead, website and invoices. It is public information and there is no reason to treat it as confidential.

The prefixes

Companies House documents the prefixes in its URI customer guide. The common ones:

And the less common ones, which a validator should still accept:

Note the pattern: the second letter of a Scottish or Northern Irish prefix usually mirrors the England and Wales prefix (OC becomes SO and NC; LP becomes SL and NL), but not always, and R0 has a digit in it. A validator should accept a letter followed by a letter or digit, then six digits, and check the prefix against the list rather than against a pattern.

The leading-zero bug

Most England and Wales company numbers in use today start with a zero, because the register passed eight digits long ago and the numbers are zero-padded. 02050399 is a valid number. 2050399 is the same number after a spreadsheet has "helpfully" converted it to an integer, and it is no longer valid: it has seven characters, and the Companies House API will not find it.

This happens on CSV import into Excel, on export from systems that store the field as a number, and in forms that strip leading zeros on the assumption that nobody types them on purpose. It is the single most common defect in company data, and it is entirely avoidable:

  • Store company numbers as text, never as an integer. In a database that is VARCHAR(8) or CHAR(8), not INT.
  • Restore zeros on input. If a value is one to seven digits, pad it to eight with leading zeros before validating or storing.
  • Quote the field on CSV export, or prefix it in a way that forces text, so a downstream spreadsheet cannot mangle it.

const COMPANY_NUMBER = /^(\d{8}|[A-Z][A-Z0-9]\d{6})$/;

function normaliseCompanyNumber(value) {
  const v = value.toUpperCase().replace(/\s/g, '');
  return /^\d{1,7}$/.test(v) ? v.padStart(8, '0') : v;
}

COMPANY_NUMBER.test(normaliseCompanyNumber('2050399'));   // true, becomes 02050399
COMPANY_NUMBER.test(normaliseCompanyNumber('sc002180'));  // true, becomes SC002180
COMPANY_NUMBER.test(normaliseCompanyNumber('SC12345'));   // false, too short for a prefixed number

The company number checker applies these rules, names the prefix, and shows the corrected eight-character form for a number that has lost its zeros.

Not the VAT number, not the UTR

Forms ask for "the company number" and receive three different things. They are easy to tell apart once you know the shapes:

A sole trader has no company number at all. A company that is not VAT registered has no VAT number. Every company has a UTR, but it is confidential and should not be requested on a public form. Ask for the identifier you actually need, validate it against its own format, and label the field precisely. The UK VAT number format covers the VAT check digits.

Looking a company up

Companies House publishes the register free of charge, and offers a free REST API that returns a company's name, status, registered office, officers, filing history and more by company number. For any flow that onboards a business, the usual pattern is:

1. Validate the format offline, as above, and restore stripped zeros. 2. Call the Companies House API with the eight-character number. 3. Show the user the registered name and address that come back and ask them to confirm, rather than asking them to type the name themselves. 4. Store the company number as the key, since names change and numbers do not.

Step 1 is cheap and catches typos instantly. Step 2 is where the truth lives. A format check alone cannot tell you whether a company exists, is active, or has been dissolved.

Company numbers in test data

Companies House reserves no range for testing, and the number space is dense: almost any eight-digit number you generate belongs to a real company, past or present. That is fine for testing format handling, prefix logic and leading-zero preservation. It is not fine if a test environment calls the Companies House API with the number and acts on the result, because the result will be a real company with a real registered office and real directors.

So, for test data:

Business onboarding (KYB, "know your business") follows the same shape as personal identity checks, and testing KYC and identity verification flows covers how to test it without touching real identities.

More guides