Updated:

How curing works

  1. Give the zombie villager the Weakness effect.
  2. While it is weak, use a normal golden apple on it.
  3. It starts shaking with red particles. A few minutes later it is a villager again.

Use a normal golden apple, not an enchanted one.

1. Summon a zombie villager

EditionCommand
Java/summon minecraft:zombie_villager ~ ~ ~
Bedrock/summon zombie_villager_v2 ~ ~ ~

On Java you can choose the profession:

/summon minecraft:zombie_villager ~ ~ ~ {VillagerData:{profession:"minecraft:librarian",level:1,type:"minecraft:plains"},PersistenceRequired:1b}

Other profession IDs are in the villager profession guide. PersistenceRequired:1b stops it despawning when you walk away.

2. Give it Weakness

EditionCommand
Java/effect give @e[type=minecraft:zombie_villager,distance=..5] minecraft:weakness 30 0
Bedrock/effect @e[type=zombie_villager_v2,r=5] weakness 30 0

This gives nearby zombie villagers 30 seconds of Weakness. A splash potion of Weakness does the same job:

/give @s minecraft:splash_potion[potion_contents={potion:"minecraft:weakness"}]

That is Java 1.20.5+ syntax; see the potion guide for other versions.

3. Use a golden apple

/give @s minecraft:golden_apple

Hold the apple and use it on the weakened zombie villager. This works in creative too.

Timing and tips

Turning villagers into zombie villagers

Whether a villager killed by a zombie becomes a zombie villager depends on difficulty: never on Easy, half the time on Normal, always on Hard. See the difficulty guide.

When it does not work

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.