NBT Tags for Villager in Minecraft (Java Edition 1.16/1.17/1.18/1.19/1.20)

This Minecraft tutorial explains the NBT tags (formerly called data tags) that you can use for a villager in Minecraft Java Edition (PC/Mac) 1.16, 1.17, 1.18, 1.19 and 1.20.

TIP: If you are not running Minecraft Java Edition (PC/Mac) 1.16/1.17/1.18/1.19/1.20, find NBT tags for villager in another version of Minecraft:

Background

In Minecraft Java Edition 1.16, 1.17, 1.18, 1.19 and 1.20, the entity value for a villager is villager. The villager entity has a unique set of data tags that can be used in Minecraft commands such as: /summon and /data.

What are NBT tags (formerly called Data Tags)?

NBT tags allow you to set certain properties of an entity (such as villager). The NBT tag is always surrounded in {} such as {NoAI:1}. If there is more than one NBT tag used in a game command, the NBT tags are separated by a comma such as {NoAI:1,CustomName:"\"Stan\""}.

List of NBT Tags

Here is a list of the NBT tags that you can use for villager in Minecraft Java Edition (PC/Mac) 1.16, 1.17, 1.18, 1.19 and 1.20:

NBT Tag Value (Description)
profession

name (The name of the profession. There are 14 different professions to choose from and each profession has different clothing.)

farmer
fisherman
shepherd
fletcher
librarian
cartographer
cleric

armorer
weaponsmith
toolsmith
butcher
leatherworker
mason
nitwit

Example for a Farmer
{VillagerData:{Profession:farmer}}

level

number (The profession level of the villager. The higher the level, the better the trades the villager can offer. If you enter a number that is higher than 5, the villager will not have any traders to offer. See villager trades to learn about the different trades based on profession and level.)

1 (Novice)
2 (Apprentice)
3 (Journeyman)
4 (Expert)
5 (Master)

TIP: A villager that is a novice will not immediately select a profession and may even switch profession. If you want the villager to hold its profession, you must spawn the villager with at least a level of "Apprentice".

Example for a Farmer that is an Apprentice
{VillagerData:{profession:farmer,level:2}}

type

biome (The name of the biome that the villager is associated with. The biome determines the clothes that the villager wears which means that a Farmer from the Plains biome will look different than a Farmer from the Taiga biome.)

plains
taiga
savanna
jungle

desert
snow
swamp

TIP: If you spawn a villager in a different biome than their own, they will seek out the biome they were created for. This makes it difficult to keep a villager in a different biome than its own.

Example for a Farmer that is an Apprentice from the Jungle biome
{VillagerData:{profession:farmer,level:2,type:jungle}}

Offers

Lists the custom trades for the villager. It uses a combination of the following tags:

"buy" is the first item to buy

"buyB" is optional and is the second item to buy

"sell" is the item that is sold by the villager

"id" is the Minecraft ID for the item

"Count" is the number of items

"maxUses" is the number of times that the trade can be done before it is unavailable

"xp" is the amount of experience earned by a player for performing the trade

"rewardExp" determines whether the player is rewarded with xp (the amount of experience set in the "xp" tag) after completing the trade

"uses" is the number of time this trade has been completed

"specialPrice" is a special price adjustment that is applied to the price of the first buy item in a trade when the Villager Trade Menu is opened for the first time (it then disappears and is not available for the 2nd, 3rd, 4th, etc time you access the Villager Trade menu. It is one time only!) Use a negative value to reduce the price of the first buy item or a positive value to increase the price of the first buy item. (NOTE: The game will not allow the adjusted price of the first buy item to be lower than 1 or exceed the stack size of the item.)

"priceMultiplier" is the price multiplier that is applied to the first buy item in a trade. The villager can increase the price of the first buy item (not the buyB item) in the trade if the "priceMultiplier" and the "demand" values are positive. (NOTE: The new adjusted price can not exceed the stack size of the item.)
Here is the formula for the price increase:

Price increase = "priceMultiplier" x "demand" x "price"

"demand" is an integer value that determines the demand for this trade which is used to adjust the price of the first buy item automatically by the villager. A negative value indicates negative demand for this trade and that players have been trading other items with the villager. A positive value indicates positive demand for this trade and that players have been completing this trade more (relative to the other trades offered by the villager). A positive "demand" value in combination with a positive "priceMultiplier" can cause the villager to increase the price of the first buy item in the trade (see formula in the "priceMultiplier" section).

Syntax
Offers:{Recipes:[{trade}, {trade}, ... {trade}]}

where trade is:
buy:{id:item,Count:<number>}, buyB:{id:item,Count:<number>}, sell:{id:item,Count:<number>}, maxUses:9999999

Example (1 trade)
Offers:{Recipes:[{buy:{id:emerald,Count:6}, sell:{id:diamond_chestplate,Count:1}, maxUses:9999999}]}

Example (2 trades)
Offers:{Recipes:[{buy:{id:emerald,Count:6}, sell:{id:diamond_chestplate,Count:1}, maxUses:9999999},
{buy:{id:blue_dye,Count:2}, buyB:{id:red_dye,Count:3}, sell:{id:golden_apple,Count:1},maxUses:9999999}]}

TIP: Try our Villager Trade Generator to help you create custom trades!
Age

ticks (The age of the villager in game ticks. Use 0 or higher for an adult. Use a negative number such as -25000 for a baby.)

Example
{Age:0} example for adult
{Age:-25000} example for baby

ForcedAge

ticks (When a baby villager matures, the Age data tag will be set to ForcedAged. However, there have been bugs with this data tag so it may not work properly.)

Example
{ForcedAge:0}

LeftHanded

0 (The villager is right-handed)
1 (The villager is left-handed)

Example
{LeftHanded:1}

CustomName

name (The name to assign to the villager)

Example
{CustomName:"\"Stan\""}

Health

number (The number of health points the villager has)

Example
{Health:25.0f}

AbsorptionAmount

number (The number of absorption health points the villager has)

Example
{AbsorptionAmount:2.0f}

Invulnerable

0 (The villager will take damage like normal)
1 (The villager will not take any damage from attacks or physical surroundings)

Example
{Invulnerable:1}

PersistenceRequired

0 (The villager will despawn naturally)
1 (The villager won't despawn)

Example
{PersistenceRequired:1}

NoAI

0 (The villager will have artificial intelligence and will move/behave like normal)
1 (The villager will have no artificial intelligence so it will appear motionless)

Example
{NoAI:1}

Silent

0 (The villager will make its usual noises in the game)
1 (The villager will not make any noise in the game)

Example
{Silent:1}

Fire

ticks (The number of game ticks until the villager is no longer on fire - there are 20 ticks in a second)

Example
{Fire:60}

PortalCooldown

ticks (The number of game ticks until the villager can go through a portal again - there are 20 ticks in a second)

Example
{PortalCooldown:120}

Air

ticks (The number of game ticks the villager has air left for)

Example
{Air:120}

id

villager (The entity value used to represent a villager in the EntityTag or Passengers tag)

Example
{id:villager}

Passengers

The mob that is riding on the villager. Use the entity value for the passenger mob

Example of skeleton as passenger
Passengers:[{id:skeleton}]

NBT Tag Examples

To summon a villager with a custom name of Stan:

/summon villager ~ ~ ~ {CustomName:"\"Stan\""}

To summon a villager that is a Master Armorer from the Taiga biome:

/summon villager ~ ~ ~ {VillagerData:{profession:armorer,level:5,type:taiga}}

To summon a villager that has a custom trade of 6 emeralds for a netherite chestplate:

/summon villager ~ ~ ~ {Offers:{Recipes:[{buy:{id:emerald,Count:6}, sell:{id:netherite_chestplate,Count:1}, maxUses:9999999}]}}

Target Selectors

Before we finish discussing data tags, let's quickly explore how to use the @e target selector. The @e target selector allows you to target entities in your commands. If you use the type=villager value, you can target villagers:

@e[type=villager]

Target Selector Examples

To change the name of the nearest villager to Joe:

/data merge entity @e[type=villager,limit=1,sort=nearest] {CustomName:"\"Joe\""}

To kill all villagers:

/kill @e[type=villager]

Next, learn how to use the game commands in Minecraft.

Command Examples

Here are some game command examples for a villager in Minecraft:

Command Generators

If you need help, you can use these tools to automatically generate commands for you: