NZ Redact

Removes IRD, NHI, bank and other New Zealand personal details from text before you paste it into AI, then puts them back into the answer.

0 characters Your text is processed in this tab and is not sent anywhere. The placeholder list is forgotten when you close the tab.

How it works

  1. Paste text into step 1, or open a .txt or .csv file. Each detail it finds is highlighted in the text and listed under Found. Untick a detail to leave it in.
  2. Copy the redacted text from step 2. Each detail is replaced by a numbered placeholder such as [IRD_1]. The same detail always gets the same placeholder, so the AI can still tell people and accounts apart.
  3. Paste the AI's answer into step 3. The placeholders turn back into the real details, ready to copy.

What it finds

NZ Redact looks for eleven kinds of New Zealand detail. Numbers that have a check digit are only flagged when the check digit is right, so order numbers and prices are left alone.

DetailHow it is recognisedExample
IRD number8 or 9 digits with Inland Revenue's check digit49-098-576
Bank accountBank, branch, account and suffix with the published bank checksum01-0902-0068389-00
NHI numberBoth Health New Zealand formats, with the check characterZAA0067
Card number13 to 19 digits that pass the Luhn check4111 1111 1111 1111
Driver licence2 letters and 6 digits after the word licence, or in a licence columnAB123456
Passport numberLetters and digits after the word passport, or in a passport columnLA123456
Date of birthA date after DOB, born or birthday, or in a DOB column12/03/1985
Email addressAny email addresssam@example.co.nz
Phone numberNZ mobiles, landlines, 0800 and +64 numbers021 123 4567
Street addressA number, a street name and a street type, with suburb, city and postcode56 Hinemoa Street, Birkenhead
NameAfter a label such as Name, Patient or Dear, in a name column, or signing off a message. Other likely names are marked possible.Patient: Eru Waaka

Accuracy

NZ Redact was tested blind on two sets of 30 New Zealand documents: emails, payroll notes, spreadsheet rows and support tickets. Both sets were written by an AI agent that was never shown the rules. For set 1 it wrote a script that fills each document with generated numbers and records every detail it puts in. For set 2 it wrote the documents and marked up the names itself. Text written by people is often messier, so treat these figures as a guide. These are the results as measured, including what it misses.

Set 1: the original 30 documents

MeasureResult
Numbers, dates, emails, phones and addresses found0%
People's names found, counting possible names (0% in version 1.0)0%
Removed details that were real details0%
Look-alikes left alone, such as order numbers and wrong check digits0

Set 2: 30 documents about names, written for version 1.1

MeasureResult
People's names found (0 of 0)0%
Removed names that were real names (0 were not)0%
Look-alike words left alone, such as places, months, and words like Will and May0

A name marked possible is a guess from the word itself, for example a common first name in a sentence. It is ticked, so it is removed, and you can untick it.

The results for the first set were known before the work on version 1.1 started. The rules were not tuned on its documents, but that is why the second set was written. It was written after the 1.1 rules were finished, by an AI agent that had not seen them, and it contains no numbers, emails or addresses, only names and look-alike words.

Set 1, by kind of detail

DetailIn the documentsFoundMissedFalse alarms

While the rules were being built, a separate set of 80 documents was used to find gaps. On that set it found 0% of numbers, dates, emails, phones and addresses, and 0% of names. All three sets are in the repository, and npm run eval measures them again.

What it does not catch

  • About a third of names. Most names are now found, but the ones missed are mostly names in ordinary sentences that are not common first names. Always read the redacted copy before you paste it, and use Remove this too for anything it missed.
  • Health details, such as a diagnosis written in words.
  • Numbers split across lines, or written in words.
  • Company GST numbers and company bank accounts use the same check digits as personal ones, so they are removed too. That is on purpose: removing too much is safer than too little.

Use in code

The rules are a single JavaScript file with no dependencies. It works in the browser and in Node.js. Copy src/nz-redact.js from GitHub, where every rule and test is published under the MIT licence.

// Find the details and make the redacted copy
const found = NZRedact.scan(text);
const { text: safe, map } = NZRedact.redact(text, found);

// Later: put the details back into the AI's answer
const { text: answer } = NZRedact.restore(aiReply, map);

Privacy

Nothing you paste is sent anywhere. The page's security policy blocks it from connecting to any server, and once it has loaded it also works offline.

There are no cookies and no tracking. If you pick a light or dark theme, that choice is saved in your own browser. The Ko-fi link opens Ko-fi's own site.