Please enable JavaScript to use CodeHS

Responsible AI & Safety

How Does Facial Recognition Work?

You probably unlock your phone just by looking at it, and your photo app might already guess which friend is in a picture. Both rely on facial recognition — and it doesn't "see" a face the way you do. It turns a face into numbers.

AI Safety ~9 min Beginner friendly
The Big Idea

A computer doesn't "see" your face

When you unlock your phone with your face, or a photo app suggests tagging a friend, it feels like the computer just looked at the picture and recognized someone — the way you'd recognize a friend across a room. But that's not really what happened.

A computer can't tell "familiar" from "unfamiliar" the way a person can. Instead, facial recognition works by turning a face into a set of measurements: the distance between your eyes, the width of your nose, the shape of your jawline, and dozens of other measurements like these, all combined into one unique numerical code for that face. That code is often called a faceprint.

Simple definition: A faceprint is a list of numbers that describes the measurements of a specific face — similar to how a real fingerprint is a pattern that's unique to one person. Facial recognition works by comparing faceprints, not by comparing pictures the way a person would.

That's a useful thing to keep in mind: the computer never really "knows" what a face looks like. It only knows a list of numbers, and it's very good at comparing lists of numbers quickly.


How It Works

How it actually works

You don't need to understand the deep math to get the general idea. Facial recognition usually happens in four steps.

Detect → Landmark → Encode → Compare
1. Detect that a face is in the image, and about where
2. Find landmark points: eyes, nose, mouth corners, jaw
3. Turn those measurements into a numerical faceprint
4. Compare that faceprint to one saved elsewhere

First, the software has to notice there's a face in the picture at all, and roughly where it is — this step doesn't know or care whose face it is yet. Next, it locates specific landmark points on that face, like the corners of the eyes, the tip of the nose, the corners of the mouth, and the edges of the jaw. Then it turns the positions and distances between those landmarks into a faceprint: a short list of numbers. Finally, it compares that faceprint to one or more faceprints that were already saved, looking for the closest match.

Verification vs. identification

That last step, "compare," can mean two very different jobs — and the difference matters.

Verification 1-to-1

"Is this the same person as this one saved faceprint?" Unlocking your own phone only has to check your face against the one faceprint stored on that device. That's a simpler yes-or-no question.

Identification 1-to-many

"Whose face is this, out of everyone in a database?" Suggesting a friend's name in a photo means comparing one faceprint against many stored ones to find the closest match. That's a much harder problem.

Why this matters: "Is this you?" (verification) and "who is this?" (identification) sound similar, but they're different problems with very different stakes. Mixing them up is exactly how a phone unlock feature and an airport security system end up compared as if they're the same thing, when they're really not.


Interactive

Try it: Match the Face

None of the faces below are real photos — they're simple shapes built from a few measurements, just like a computer would use. Drag the sliders to change the "face to scan," and watch the widget find the closest match in the gallery of known faceprints. This is exactly what identification looks like: comparing one set of numbers against many.

Live Demo Adjust a measurement and see which known face the computer thinks is the closest match.

Face to Scan

Faceprint: [48, 30, 58]

Closest match: Face C — distance 0.0

Notice what's actually happening: the computer isn't looking at the two faces and thinking "those look similar." It's calculating which set of numbers is mathematically closest to the other. Move the eye-distance slider just a little, and the "closest match" can flip to a completely different face — because the numbers changed, not because anything actually looks more or less alike to a human eye.


Where It Shows Up

Where you've already seen this

Facial recognition isn't some far-off future technology — it's already part of daily life in a lot of places:

Unlocking a phone

Face unlock checks your face against the one faceprint saved on your device — that's verification.

Tagging photos

Some photo apps suggest a friend's name because their faceprint is close to ones already tagged in your library.

Airport check-in

Some airports match your face at the gate against the photo on your passport or boarding pass.

Security & access

Some offices and buildings use a face scan instead of a badge or key to unlock a door.

Security cameras

Some schools and stores use camera systems that can flag a face that matches a watch list.


Worth Knowing

Concerns worth knowing about

Facial recognition is powerful, but it isn't perfect, and it raises real questions that are still being worked out.

Accuracy isn't equal for everyone. Multiple studies have found that many facial recognition systems are measurably less accurate for some skin tones and genders than others — meaning some people are more likely to be misidentified than others. That's a well-documented, real fairness problem. You'll go deeper into why AI systems pick up unfair patterns like this in the next tutorial in this series, AI Bias and Fairness.

Privacy. A camera in a public place could identify someone who never agreed to it and has no idea it happened. That's very different from choosing to set up face unlock on your own phone.

Rules vary a lot. Because of these open questions about accuracy and privacy, schools, states, and countries have very different rules about when facial recognition is allowed — some ban it in schools entirely, some allow it with limits, and some don't regulate it much yet at all.


Your Turn

Check your understanding

Imagine your school is considering using facial recognition to check students into the cafeteria line instead of ID cards. What's one benefit of doing this, and one concern you'd want the school to think through first?

Your answer:

Sample answer: One benefit is speed — students wouldn't need to carry or scan a physical ID card, so the line could move faster. One concern is that the system might be less accurate for some students than others, or that the school would be storing sensitive faceprint data on lots of kids, which raises privacy questions about how that data is stored, who can see it, and what happens to it later.


Check Yourself

Quick quiz

1. What is a "faceprint"?

2. Unlocking your own phone with your face is an example of which task?

3. Which of these is a well-documented, real concern about facial recognition?

Keep learning about responsible AI

Now that you've seen how a face becomes a set of numbers a computer can compare, find out how AI systems can pick up unfair patterns from the data they're trained on — and see it happen in an interactive hiring-model demo.

Part of the Responsible AI & Safety tutorial series.