Skip to content

NIP

19700503Birth date
3 May 1970
200108Appointment month (TMT)
August 2001
2Sex
Female
168Serial number

Well-formed

The 18-digit NIP has two layouts:

Kind Layout Basis
pns Birth date YYYYMMDD, appointment YYYYMM, sex digit, 3-digit serial Perka BKN 22/2007
pppk Birth date YYYYMMDD, appointment year YYYY, agreement count from 21, sex digit, serial Peraturan BKN 1/2019
Go TypeScript Returns
nip.Valid(s) nip.isValid(s) Whether s is a well-formed NIP
nip.Parse(s) nip.parse(s) The fields below
nip.Format(s) nip.format(s) 19881227 200809 2 553
nip.Mask(s) nip.mask(s) Last 4 digits visible

Accepted separators: space, . and -.

Field (JSON) Example Notes
nip 18 digits
kind pns pns or pppk
birthDate 1988-12-27
appointmentDate 2008-09 YYYY-MM for PNS, YYYY for PPPK
sex female Digit 1 is male, 2 is female
serial 553
agreement 1 PPPK only: which work agreement (21 is the first)

length, charset, date, sex, serial.

package main
import (
"fmt"
"github.com/haikalmumtaz233/nusaindex/nip"
)
func main() {
fmt.Println(nip.Valid("198812272008092553"))
civil, err := nip.Parse("198812272008092553")
if err == nil {
fmt.Println(civil.Kind, civil.BirthDate, civil.AppointmentDate, civil.Sex)
}
contract, err := nip.Parse("199005172021212541")
if err == nil {
fmt.Println(contract.Kind, contract.AppointmentDate, contract.Agreement)
}
formatted, err := nip.Format("198812272008092553")
if err == nil {
fmt.Println(formatted)
}
fmt.Println(nip.Mask("198812272008092553"))
}
Output
true
pns 1988-12-27 2008-09 female
pppk 2021 1
19881227 200809 2 553
**************2553