How are deepfakes made?
Deepfakes are made by training neural networks on hundreds to thousands of images of a target face. Two classic methods dominate: autoencoders that learn to compress and rebuild faces, and GANs that pit a 'generator' against a 'discriminator' until fakes look real. Modern 2026 tools add diffusion models for sharper, faster output.
Why — the first-principles explanation
A deepfake works because a neural network can learn the visual 'grammar' of a specific face. You feed it many photos of a person, and it learns how that face looks from every angle, in every expression and lighting condition. The U.S. Government Accountability Office describes the core step plainly: developing a deepfake typically involves feeding hundreds or thousands of images into a neural network, 'training' it to identify and reconstruct patterns, usually faces.
The oldest reliable method is the autoencoder. Think of it as a squeeze-and-rebuild machine: an encoder compresses a face into a small set of numbers (its essential features), and a decoder rebuilds the full image from those numbers. Train one shared encoder plus a separate decoder for each person, then swap the decoders. Person A's expressions get rebuilt as Person B's face, because A's compressed 'expression code' is fed into B's rebuilder.
The second method is the Generative Adversarial Network (GAN), invented in 2014. Two networks fight: a generator produces fake faces, and a discriminator tries to tell fakes from real photos. Each round, the generator learns from its failures and the discriminator gets pickier. After millions of rounds, the generator produces images the discriminator can no longer catch, and often neither can a human.
Since about 2023, many consumer tools have shifted to diffusion models, which build an image by starting from random noise and repeatedly 'denoising' it toward a realistic face. Face-swap apps also add supporting steps: detecting the face, aligning landmarks (eyes, nose, mouth), pasting the generated face, then color-correcting and blending edges so seams disappear.
An example that makes it click
Imagine two art students copying a famous portrait. One student (the generator) paints forgeries; the other (the discriminator) is a detective who inspects each painting and shouts 'fake!' when something's off. At first the forgeries are terrible and the detective catches every one. But each time the detective explains the giveaway, the forger fixes it. After 10,000 rounds, the forger paints something so good the detective flips a coin.
An autoencoder is more like a photocopier that first shrinks a face down to a tiny sketch on a sticky note, then redraws the full face from that note. If you hand your friend's 'sketch note' to a machine trained to draw your face, out comes your face making your friend's exact expression.
How to do it
- Collect training data: gather hundreds to thousands of images or video frames of the target face across angles, expressions, and lighting.
- Preprocess: detect faces, crop, and align facial landmarks (eyes, nose, mouth) so every image lines up.
- Train the model: run an autoencoder, GAN, or diffusion model until it can reconstruct the face convincingly (hours to days on a GPU).
- Generate: feed in the source video or photo so the model renders the target face onto it, frame by frame.
- Blend and refine: color-correct, smooth edges, and re-composite so the swapped face matches skin tone, lighting, and motion.
Key facts
- Training a face model typically requires hundreds to thousands of images (GAO).
- Generative Adversarial Networks (GANs) were introduced by Ian Goodfellow and colleagues in 2014.
- The term 'deepfake' originated on Reddit in late 2017 from a user of the same name.
- Three main architectures are used today: autoencoders, GANs, and (since ~2023) diffusion models.
- GAO names two techniques: face swapping (one face onto another body) and facial manipulation (copying expressions).
▶ The 60-second explainer (script)
Deepfakes are made by training a neural network on hundreds or thousands of pictures of one person's face. Here's how it actually works. The classic method is an autoencoder: it squeezes a face down into a few key numbers, then rebuilds it. Train two rebuilders, swap them, and one person's expressions come out wearing another person's face. The second method is a GAN, where two networks compete: one paints fakes, the other plays detective. Round after round, the forger improves until the detective can't tell real from fake. Newer 2026 tools use diffusion models that sculpt a face out of pure noise. Finally, the software aligns the face, blends the edges, and color-matches so the seam disappears. That's the whole recipe: lots of images, a competitive learning loop, and careful blending.
What authoritative sources say
People also ask
Do you need thousands of photos to make a deepfake?
Older methods do, but modern face-swap apps can produce a rough single-photo swap. High-quality, moving video deepfakes still benefit from many images or video frames of the target.
What's the difference between a GAN and an autoencoder deepfake?
An autoencoder compresses and rebuilds a face to swap identities. A GAN uses two competing networks, a generator and a discriminator, that train against each other until the fakes look real.
How long does it take to make a deepfake?
A consumer app photo swap takes seconds. Training a custom high-quality video model can take hours to days on a graphics card, plus rendering time.
Are deepfakes always faces?
No. The same techniques synthesize voices (voice cloning) and can manipulate whole scenes, but face swapping and facial reenactment are the most common uses.