A Vietnamese tax code (Mã số thuế, MST) is the identifier the General Department of Taxation issues to every enterprise and individual taxpayer. Enterprises receive a 10-digit code, and each branch or dependent unit receives a 13-digit code built from the parent’s 10 digits plus a 3-digit branch number. Before relying on an MST on a Vietnamese electronic invoice (hóa đơn điện tử) or supplier record, you can confirm it is well-formed with the official check-digit rule. This free validator runs that exact check in your browser.
Why MST validation matters for e-invoices
Vietnam’s electronic invoice system (hóa đơn điện tử, or HĐĐT) requires both buyer and seller MSTs to be valid and active for an invoice to be accepted by the tax authority. An invoice with an invalid or inactive MST can be rejected, blocking input VAT claims or deductible expense recognition for the buyer. Validating the structural check digit before creating or approving an invoice catches the most common errors — typos, transposed digits, or outdated codes — before they cause a compliance problem.
This is particularly relevant when onboarding new Vietnamese suppliers or customers where you are collecting tax codes manually. A check-digit validation catches a mistyped digit in seconds; a failed invoice validation later can take days to resolve through the supplier’s tax office.
How the check digit is calculated
The tenth digit of the 10-digit base is a check digit:
- Strip any dashes and spaces from the input.
- Multiply the first nine digits by the weights 31, 29, 23, 19, 17, 13, 7, 5, 3 respectively.
- Sum the nine products to get the weighted total.
- Compute
11 − (total mod 11). If the result is 11 it maps to 0 (valid); if the result is 10 the code structure is invalid because that digit is never issued. - The MST passes when the computed value matches the actual tenth digit.
For a 13-digit branch code, the first 10 digits validate exactly as above, and the trailing 3 digits are the branch sequence number, formatted as XXXXXXXXXX-YYY.
Detailed example
Suppose an enterprise MST has first nine digits that produce a weighted sum of 295.
295 mod 11 = 9(because 295 = 26×11 + 9)- Expected check digit =
11 − 9 = 2 - If the tenth digit is
2, the code is structurally valid. - If it is any other digit, the code contains an error.
For a branch: strip the dash and take the first 10 digits through the same calculation. The last three (001, 002, …) identify the specific branch and do not affect the check.
What validation does not tell you
A structurally valid MST is not guaranteed to belong to an active or legitimate business. The General Department of Taxation’s public portal (tracuunnt.gdt.gov.vn or equivalent) allows lookup by MST to verify registration status and taxpayer name. For supplier onboarding and e-invoice compliance, the recommended process is: validate structure here first, then look up the MST on the official portal to confirm the enterprise is registered and active. Everything here runs locally — your tax code never leaves your device.
Enterprise vs branch codes in practice
| Length | Format | Identifies | Example shape |
|---|---|---|---|
| 10 digits | XXXXXXXXXX | The enterprise (legal entity) | 0101243150 |
| 13 digits | XXXXXXXXXX-YYY | A dependent unit / branch | 0101243150-001 |
The branch suffix (001, 002, …) is a plain sequence assigned by the parent and does
not carry its own check digit — only the leading 10 digits are validated by the
modulo-11 rule. When a counterparty gives you a 13-digit code, the check is still run on
the first 10; the suffix simply tells you which branch of that enterprise issued the
invoice.
The modulo-11 rule, restated
The weights 31, 29, 23, 19, 17, 13, 7, 5, 3 are applied to digits 1–9, the products are
summed, and the check digit is 11 − (sum mod 11) with the two special cases: a result of
11 becomes 0, and a result of 10 marks the code invalid (that digit is never issued). This
is the same family of ISO 7064-style weighted checks used by many tax authorities, chosen
because it reliably catches both single-digit typos and adjacent transpositions — the two
most common manual-entry errors.
Reading the two MST formats side by side
The 10-digit MST identifies an independent taxpayer; the 13-digit form (10 digits, a hyphen, then a 3-digit branch suffix) identifies a dependent unit such as a branch office. For invoicing and contracts, match the exact format the counterparty registered — a branch’s 13-digit code is not interchangeable with its parent’s 10-digit code, and e-invoice systems reject the mismatch.
Sources
- General Department of Taxation (Tổng cục Thuế) — gdt.gov.vn — the authority that issues the MST.
- Taxpayer lookup portal — tracuunnt.gdt.gov.vn — official registration-status check by MST.