NPWP
- 0Prefix for a 15-digit NPWP
- 15Taxpayer type
- 067320Registration number
- 0Check digit
- 246Tax office (KPP)
- 000Head office or branch
- Head office
Well-formed
Three formats are accepted (PMK 112/2022 as amended by PMK 136/2023):
- 15 digits, the legacy format (
02.973.675.8-100.600). - 16 digits, either
0followed by the legacy 15 digits, or a NIK for individual residents. - NITKU, 22 digits: the 16-digit NPWP plus a 6-digit business place number.
Functions
Section titled “Functions”| Go | TypeScript | Returns |
|---|---|---|
npwp.Valid(s) |
npwp.isValid(s) |
Whether s is a well-formed NPWP or NITKU |
npwp.Parse(s) |
npwp.parse(s) |
The fields below |
npwp.To16(s) |
npwp.to16(s) |
The 16-digit form of any accepted format |
npwp.Format(s) |
npwp.format(s) |
15 digits in the dotted layout, otherwise digits only |
npwp.Mask(s) |
npwp.mask(s) |
Last 4 digits visible |
Accepted separators: space, . and -.
Parsed fields
Section titled “Parsed fields”| Field (JSON) | Present when | Notes |
|---|---|---|
npwp16 |
Always | |
npwp15 |
Not a NIK | Legacy 15 digits |
nitku |
Input is a NITKU | 22 digits |
businessPlace |
Input is a NITKU | Last 6 digits |
isNik |
Always | The 16 digits are a NIK |
taxOffice |
Not a NIK | 3-digit tax office code (KPP) |
status |
Not a NIK | 3-digit status (000 = head office) |
There is no official check digit for NPWP published by DJP, so NusaIndex checks structure only. New taxpayers since 2024 receive a 16-digit NPWP without a public structure.
Errors
Section titled “Errors”length, charset, nik (16 digits that look like a NIK but are not a valid one), serial.
Example
Section titled “Example”package main
import ( "fmt"
"github.com/haikalmumtaz233/nusaindex/npwp")
func main() { fmt.Println(npwp.Valid("02.973.675.8-100.600"))
parsed, err := npwp.Parse("02.973.675.8-100.600") if err == nil { fmt.Println(parsed.NPWP16, parsed.NPWP15, parsed.TaxOffice, parsed.IsNIK) }
sixteen, err := npwp.To16("029736758100600") if err == nil { fmt.Println(sixteen) }
formatted, err := npwp.Format("029736758100600") if err == nil { fmt.Println(formatted) }
fmt.Println(npwp.Mask("0029736758100600"))}import * as npwp from "nusaindex/npwp";
console.log(npwp.isValid("02.973.675.8-100.600"));
const parsed = npwp.parse("02.973.675.8-100.600");if (parsed.ok) { const { npwp16, npwp15, taxOffice, isNik } = parsed.value; console.log(npwp16, npwp15, taxOffice, isNik);}
const sixteen = npwp.to16("029736758100600");if (sixteen.ok) { console.log(sixteen.value);}
const formatted = npwp.format("029736758100600");if (formatted.ok) { console.log(formatted.value);}
console.log(npwp.mask("0029736758100600"));true0029736758100600 029736758100600 100 false002973675810060002.973.675.8-100.600************0600© 2026 Haikal Mumtaz