Skip to content

VersusGPU

GFPGAN vs CodeFormer: Which AI Face Restorer Should You Run Locally?

GFPGAN and CodeFormer are the two best-known free AI face restorers for old photos. We compare how they work, their controls, extra features, hardware needs and, crucially, their licences, so you can choose the right one for family photos or paid work.

By , Senior Hardware Editor

4 min read

GFPGAN vs CodeFormer: Which AI Face Restorer Should You Run Locally?

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.

The bottom line

CodeFormer is the more flexible tool for personal photo restoration, thanks to its fidelity slider and its video, colourisation and inpainting options. GFPGAN is the better choice for commercial work because of its Apache 2.0 licence, and its clean version doesn't need custom CUDA extensions. Neither fixes scratches across the whole photo, and neither recovers real detail, so keep your originals and compare both on your own scans.

Sources

  1. 01Tencent ARC, GFPGAN GitHub repository and README
  2. 02Tencent ARC, GFPGAN licence
  3. 03S-Lab, Nanyang Technological University, CodeFormer GitHub repository and README
  4. 04S-Lab, CodeFormer licence (NTU S-Lab License 1.0)
  5. 05chaiNNer, Spandrel GitHub repository
  6. 06Microsoft, Bringing Old Photos Back to Life GitHub repository

About the author

Callum Reid

Senior Hardware Editor

Callum leads GPU, CPU and platform architecture coverage at Forge PC. Before joining the editorial desk, he spent nine years specifying, assembling and stress-testing custom gaming and workstation systems in the UK, with a focus on PCIe bandwidth, VRM thermal design, DDR5 memory tuning and 1440p/4K frame-time consistency.

More from Callum Reid

Read next

Best Local AI Image Captioning Tools in 2026

Best Picks

Best Local AI Image Captioning Tools in 2026

You don't need a paid cloud service to caption images for LoRA training, alt text or photo archives. We pick the best free AI captioning and tagging tools you can run on your own PC in 2026, from the TagGUI desktop app to Florence-2, JoyCaption, WD Tagger v3 and the kohya-ss tagging script, with hardware and licence notes.

Hannah Vance5 min

JoyCaption vs Florence-2: Which Local AI Image Captioner Should You Use?

Versus

JoyCaption vs Florence-2: Which Local AI Image Captioner Should You Use?

JoyCaption and Microsoft's Florence-2 are two of the most popular free AI models for captioning images on your own PC. We compare their size, video memory needs, caption styles, extra features and licences, so you can pick the right one for LoRA training datasets, alt text or a big photo archive.

Callum Reid5 min

How to Auto-Caption a LoRA Training Dataset Locally With TagGUI

How-To

How to Auto-Caption a LoRA Training Dataset Locally With TagGUI

Writing captions for every image in a LoRA training set by hand is slow. TagGUI is a free desktop app that runs AI captioning models such as Florence-2, WD Tagger and JoyCaption on your own PC and writes the text files for you. Using its official README, we explain how to install it, run batch captioning, steer the output and clean up the results.

Marcus Thorne6 min

Cyber Monday 2026 UK: What to Expect for PC Parts After Black Friday

News

Cyber Monday 2026 UK: What to Expect for PC Parts After Black Friday

Cyber Monday is on 30 November 2026, and for UK PC parts it's the last day of the same sale rather than a new one. VantaSpec counted 402 of 1,413 recent price cuts as genuine 90-day lows on 28 November. Here's what to expect on Monday, when to buy now or wait, and how your return rights work.

Eleanor Shaw3 min