GFPGAN and CodeFormer are the two names you'll see most often when people talk about fixing blurry or damaged faces in old photos. Both are free, both run on your own graphics card, and both turn up inside other apps, from chaiNNer to Stable Diffusion web interfaces. They're not interchangeable, though. They differ in how much control you get, what extra jobs they handle and, most importantly, what their licences let you do. This comparison is based on each project's official GitHub README and licence.
At a glance
| GFPGAN | CodeFormer |
|---|
Developer | Applied Research Center (ARC), Tencent PCG | S-Lab, Nanyang Technological University |
Paper | CVPR 2021 | NeurIPS 2022 |
Approach | Uses priors from a pretrained face GAN such as StyleGAN2 | Codebook lookup transformer |
Main control | Model version (1, 1.2, 1.3) and upscale factor | Fidelity weight from 0 to 1 |
Extra jobs | Background enhancement with Real-ESRGAN | Background enhancement, video, face colourisation, face inpainting |
Requirements listed | Python 3.7+, PyTorch 1.7+, Nvidia GPU and CUDA optional | PyTorch 1.7.1+, CUDA 10.1+ |
Licence | Apache 2.0 (except listed third-party parts) | NTU S-Lab License 1.0, non-commercial |
How they work
Both are "blind" face restoration models: they don't need to know how a photo was damaged. GFPGAN's developers describe it as a practical algorithm for real-world face restoration that uses the rich priors in a pretrained face GAN, such as StyleGAN2. CodeFormer's paper title calls it a codebook lookup transformer. In both cases the model finds faces, predicts a cleaner version of each and blends them back into the image. Either way, the result is the model's best guess at the detail, not recovered information, so keep your original scans.
Control and model choice
GFPGAN gives you a choice of model versions instead of a slider. Its README says V1.3 produces more natural results and works better on very low-quality and high-quality inputs, but isn't very sharp and slightly changes identity. V1.2 is sharper and adds a "beauty makeup" look, but some outputs are unnatural. The update log adds V1.4, which the developers say produces slightly more detail and better identity than V1.3. They also point out that V1.3 isn't always better than V1.2, so it's worth trying more than one. The command-line -s option sets the final upscale factor, which defaults to 2.
CodeFormer has a single fidelity weight, -w, between 0 and 1. Its README says smaller values tend to give higher-quality results and larger values give higher fidelity to the input. For family photos, where it matters that grandad still looks like grandad, that slider is the most useful control either tool offers.
Features beyond faces
Both can hand the rest of the image to Real-ESRGAN. GFPGAN's -bg_upsampler option defaults to Real-ESRGAN (the README says you need to install the realesrgan package for background enhancement), and CodeFormer has a --bg_upsampler realesrgan flag plus --face_upsample.
CodeFormer does more on its own. It accepts video clips, and it has separate scripts for colourising black-and-white face crops and for inpainting masked areas of a face. GFPGAN's README covers images only. Its original paper model (V1) included colourisation, but V1.2 dropped it, and V1.3 is based on V1.2.
Neither tool repairs scratches or creases in the rest of the photo. For that, Microsoft's Bringing Old Photos Back to Life project has a dedicated scratch-detection mode.
Hardware and setup
Neither project publishes a minimum VRAM figure. GFPGAN lists an Nvidia GPU with CUDA as optional and offers a "clean" version that doesn't need custom CUDA extensions. CodeFormer's README lists CUDA 10.1 or newer, so plan on an Nvidia card. Both are small models compared with the image generators and large language models we usually cover. As our suggestion rather than an official requirement, a mainstream card such as the ASUS RTX 5060 Ti 16GB Dual OC has plenty of room for face restoration alongside other local AI work. Our guide to how much VRAM you need explains the trade-offs.
Installation is similar: clone the repository, install the Python requirements and download the model weights. GFPGAN's README installs the basicsr and facexlib packages with pip before its own requirements, while CodeFormer's README uses a conda environment with Python 3.8. Our step-by-step guide to restoring old photos with CodeFormer walks through it.
If you'd rather use a graphical app, Spandrel, the model-loading library behind chaiNNer, supports GFPGAN in its main package. CodeFormer is only in its separate extra-architectures package, which the Spandrel developers reserve for non-commercial and private projects.
Licences: the deciding factor for many people
This is the biggest difference between the two. GFPGAN is released under the Apache 2.0 licence, apart from third-party components listed in its licence file, so it's generally fine for commercial work. CodeFormer's S-Lab License 1.0 only permits redistribution and use for non-commercial purposes.
If you're restoring your own family photos, either is fine. If you run a photo restoration business, edit pictures for paying clients or are building an app, GFPGAN is the safer choice unless you have permission from CodeFormer's authors.
Which should you choose?
Choose CodeFormer if you're restoring personal photos, want a simple slider to balance quality against likeness, or need video, face colourisation or inpainting.
Choose GFPGAN if you need a commercial-friendly licence, want a version that doesn't need custom CUDA extensions, or prefer to compare different model versions.
Many people simply install both. They're free, and comparing them on the same scan is the quickest way to see which suits your photos.