← All demos
k_ai-basics · Demo 09 · PII redaction

Hide private info from AI

What it hides, and what it misses

This is a simple example for learning. Real apps use many layers of protection, not just one.

More detail

This is a simplified teaching example, not a production security tool. Real systems need defense in depth, not a single regex filter.

Imagine a friend is helping you with a letter from your bank. The letter has private details on it. So first, you take a black marker and cross out your ID number, card number and email. Your friend can still help, but cannot see those details.

We can do the same for AI. People often paste letters and files into AI tools, and these can have private details in them. A program can act as the black marker. It hides those details before the AI sees them. Private details are called PII (personal information), and hiding them is called redaction. But the marker only hides what it knows how to spot.

Every detail on this page is made up. None of them belong to a real person.

More detail

The ID numbers start with 000 (never used for real ones), the card number is a standard test number, and the emails end in example.com.

6 examples: what does the AI see?

Each example goes past the black marker. On the left is what someone wrote. On the right is what the AI sees.

  1. An ID number

    000-99-8888 → AI sees [REDACTED-SSN]

    ✅ Hidden. The marker knows this shape: 3 numbers, a dash, 2 numbers, a dash, 4 numbers.

  2. The same ID number, with dots

    000.99.8888 → AI sees 000.99.8888

    ❌ Missed. A person can see it is the same number. But the marker only knows the one with dashes.

  3. An email address

    sam@example.com → AI sees [REDACTED-EMAIL]

    ✅ Hidden. It has an @ sign and a dot, and the marker looks for those.

  4. The same email, written in words

    sam at example dot com → AI sees sam at example dot com

    ❌ Missed. There is no @ sign, so the marker does not spot it. (People write emails like this to avoid spam.)

  5. A card number

    4111 1111 1111 1111 → AI sees [REDACTED-CARD]

    ✅ Hidden. 16 numbers in groups of 4 is what the marker looks for.

  6. A person's name

    John Smith → AI sees John Smith

    ❌ Missed. To a computer, a name is just two words. Nothing about it says "this is a name".

The marker swaps each private detail for a label, like [REDACTED-SSN]. "Redacted" means "hidden". (SSN is an ID number used in the US.)

The lesson: the marker hides private details written the usual way. It misses names, and details written a little differently. Hiding private details from AI is harder than it looks.

Watch it work on 3 made-up messages

Press the button. The marker goes through 3 made-up messages: a support request, an order note and a chat. You will see what it hid and what it missed.

Getting the demo ready in your browser…

Try it yourself

Tap an example to put it in the box. Then change it a little and see what happens. Can you write a number so the marker misses it?

Only use made-up details, never real ones. Nothing you type leaves your device.

What the AI sees: