NBT Tags for Player 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 player 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 player in another version of Minecraft:

Background

Players have a unique set of NBT tags that can be used in Minecraft commands such as: /data and /scoreboard.

player

What are NBT tags (formerly called Data Tags)?

NBT tags allow you to set certain properties of a player. The NBT tag is always surrounded in {} such as {Dimension:"minecraft:the_nether"}. If there is more than one NBT tag used in a game command, the NBT tags are separated by a comma such as {Dimension:"minecraft:the_nether", foodLevel:20}.

List of NBT Tags

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

NBT Tag Value (Description)
abilities

data (The abilities that the player has.)

  • invulnerable - determines whether the player take damage like normal (0 or 1)
  • mayfly - determines whether the player can fly (0 or 1)
  • instabuild - demeterines whether the player can instantly place or destroy blocks (0 or 1)
  • walkSpeed - the speed that the player can walk (default is 0.1f)
  • mayBuild - determines whether the player is allowed to build by placing or destroying block (0 or 1)
  • flying - the player is currently flying (0 or 1)
  • flySpeed - the speed that the player can fly (default is 0.05f)

Example
{abilities:{invulnerable:1,mayfly:1,instabuild:1,walkSpeed:0.1f,mayBuild:1,flying:0,flySpeed:0.05f}}

AbsorptionAmount

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

Example
{AbsorptionAmount:2.0f}

Air

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

Example
{Air:300s}

DataVersion

version (The version of the player's NBT structure. Each version/snapshot of Minecraft has its own unique version number. Minecraft 1.16 rc-1 has a DataVersion value of 2565)

Example
{DataVersion:2565}

DeathTime

number (The number of game ticks that the player has been dead. When alive, DeathTime has a value of 0)

Example
{DeathTime:0}

Dimension

minecraft:the_nether (The player is the Nether)
minecraft:overworld (The player is in the Overworld)
minecraft:the_end (The player is in the End)

Example
{Dimension:"minecraft:the_nether"}

EnderItems

data (An item in the player's ender chest)

Example
{EnderItems:[{id:"minecraft:diamond_sword"}]}

enteredNetherPosition

coordinate (The xyz coordinate value where the player entered the Nether dimension)

Example
{enteredNetherPosition:{x:-259.888617739718d,y:65.16610926093821d,z:185.8149890186918d}}

FallDistance

number (The distance that the player has fallen)

Example
{FallDistance:0.0f}

FallFlying

0 (The player is not allowed to use elytra when falling)
1 (The player is allowed to use elytra when falling)

Example
{FallFlying:1}

Fire

ticks (The number of game ticks until the player is no longer on fire - there are 20 ticks in a second. When the player is not on fire, the default is -20)

Example
{Fire:-20s}

foodLevel

number (The level in the Hunger bar. A full Hunger bar has a value of 20)

Example
{foodLevel:20}

foodExhaustionLevel

number (The level of exhaustion)

Example
{foodExhaustionLevel:0}

foodSaturationLevel

number (The current level of saturation)

Example
{foodSaturationLevel:5}

foodTickTimer

ticks (The value of the Food timer in game ticks)

Example
{foodTickTimer:0}

Health

number (The number of health points the player has)

Example
{Health:20.0f}

HurtTime

ticks (The number of game ticks that the player turns red after being hurt)

Example
{HurtTime:0}

Inventory

data (An item in the player's inventory)

Example
{Inventory:[{id:"minecraft:diamond_sword"}]}

Invulnerable

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

Example
{Invulnerable:0}

OnGround

0 (The player is not on the ground)
1 (The player is on the ground)

Example
{OnGround:1}

playerGameType

0 (The player is in Survival mode)
1 (The player is in Creative mode)
2 (The player is in Adventure mode)
3 (The player is in Spectator mode)

Example
{playerGameType:1}

PortalCooldown

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

Example
{PortalCooldown:120}

Pos

coordinate (The xyz coordinate value where the player is currently positioned)

Example
{Pos:{x:-255.888617739718d,y:66.16610926093821d,z:186.8149890186918d}}

previousPlayerGameType

0 (The player was previously in Survival mode)
1 (The player was previously in Creative mode)
2 (The player was previously in Adventure mode)
3 (The player was previously in Spectator mode)

Example
{previousPlayerGameType:3}

recipeBook

data (A list of the recipes the player knows how to craft)

Example
{recipeBook: {recipes:["minecraft:diamond_sword"]}}

SelectedItem

data (The item that is currently selected in the hotbar)

Example
{SelectedItem:{id:"minecraft:diamond_sword",Count:1b}}

Score

number (The value that will be displayed as the Score when the player dies)

Example
{Score:126}

seenCredits

0 (The player has not yet gone into the final portal that ends the game and seen the credits)
1 (The player has gone into the final portal that ends the game and has seen the credits)

Example
{seenCredits:0}

selectedItemSlot

0 (The player has the slot #1 selected in the hot bar)
1 (The player has the slot #2 selected in the hot bar)
2 (The player has the slot #3 selected in the hot bar)
3 (The player has the slot #4 selected in the hot bar)
4 (The player has the slot #5 selected in the hot bar)
5 (The player has the slot #6 selected in the hot bar)
6 (The player has the slot #7 selected in the hot bar)
7 (The player has the slot #8 selected in the hot bar)
8 (The player has the slot #9 selected in the hot bar)

Example
{selectedItemSlot:0}

ShoulderEntityLeft

data (The entity sitting on the player's left shoulder. Currently, this can only be a parrot)

Example
{ShoulderEntityLeft:{id:"minecraft:parrot"}}

ShoulderEntityRight

data (The entity sitting on the player's right shoulder. Currently, this can only be a parrot)

Example
{ShoulderEntityRight:{id:"minecraft:parrot"}}

SleepingX

number (The X coordinate of where the player is sleeping)

Example
{SleepingX:-851}

SleepingY

number (The Y coordinate of where the player is sleeping)

Example
{SleepingY:66}

SleepingZ

number (The Z coordinate of where the player is sleeping)

Example
{SleepingZ:193}

SleepTimer

ticks (The number of game ticks that the player has been sleeping in a bed)

Example
{SleepTimer:2400}

SpawnDimension

minecraft:the_nether (The player will spawn in the Nether)
minecraft:overworld (The player will spawn in the Overworld)
minecraft:the_end (The player will spawn in the End)

Example
{SpawnDimension:"minecraft:overworld"}

SpawnForced

0 (The player will not spawn if no bed is found)
1 (The player will spawn if no bed is found)

Example
{SpawnForced:0}

SpawnX

number (The X coordinate of the player's bed or spawn point)

Example
{SpawnX:520}

SpawnY

number (The Y coordinate of the player's bed or spawn point)

Example
{SpawnY:97}

SpawnZ

number (The Z coordinate of the player's bed or spawn point)

Example
{SpawnZ:101}

XpLevel

number (The level on the experience bar)

Example
{XpLevel:20}

XpP

number (The percentage on the experience bar until the next level)

Example
{XpP:50}

XpSeed

number (The seed that will be used for the next enchantment when using an enchanting table)

Example
{XpSeed:238209655}

XpTotal

number (The total XP earned during the current life. This value is displayed as the Score when player dies)

Example
{XpTotal:126}

NBT Tag Examples

To get the NBT tags (or data tags) for the nearest player:

/data get entity @p

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