Get, Merge, and Modify NBT Data
The /data command in Minecraft Java Edition lets you inspect, merge, and modify the NBT data of blocks, entities, and command storage. It requires operator permission level 2, which means cheats must be turned on in single-player worlds.
Players and mapmakers use this command to inspect player inventory paths, change mob attributes like AI settings, copy data between block containers, or store values inside namespaced storage IDs.
/data get block <target>/data get block <target> <path> [<scale>]/data get entity <target>/data get entity <target> <path> [<scale>]/data get storage <target>/data get storage <target> <path> [<scale>]/data merge block <target> <nbt>/data merge entity <target> <nbt>/data merge storage <target> <nbt>/data modify block <target> <targetPath> append compute block <computePos> float <provider>/data modify block <target> <targetPath> append compute block <computePos> integer <provider>/data modify block <target> <targetPath> append compute default float <provider>/data modify block <target> <targetPath> append compute default integer <provider>/data modify block <target> <targetPath> append compute entity <computeTarget> float <provider>/data modify block <target> <targetPath> append compute entity <computeTarget> integer <provider>/data modify block <target> <targetPath> append from block <source> [<sourcePath>]/data modify block <target> <targetPath> append from entity <source> [<sourcePath>]/data modify block <target> <targetPath> append from storage <source> [<sourcePath>]/data modify block <target> <targetPath> append string block <source>/data modify block <target> <targetPath> append string block <source> <sourcePath>/data modify block <target> <targetPath> append string block <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> append string entity <source>/data modify block <target> <targetPath> append string entity <source> <sourcePath>/data modify block <target> <targetPath> append string entity <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> append string storage <source>/data modify block <target> <targetPath> append string storage <source> <sourcePath>/data modify block <target> <targetPath> append string storage <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> append value <value>/data modify block <target> <targetPath> insert <index> compute block <computePos> float <provider>/data modify block <target> <targetPath> insert <index> compute block <computePos> integer <provider>/data modify block <target> <targetPath> insert <index> compute default float <provider>/data modify block <target> <targetPath> insert <index> compute default integer <provider>/data modify block <target> <targetPath> insert <index> compute entity <computeTarget> float <provider>/data modify block <target> <targetPath> insert <index> compute entity <computeTarget> integer <provider>/data modify block <target> <targetPath> insert <index> from block <source> [<sourcePath>]/data modify block <target> <targetPath> insert <index> from entity <source> [<sourcePath>]/data modify block <target> <targetPath> insert <index> from storage <source> [<sourcePath>]/data modify block <target> <targetPath> insert <index> string block <source>/data modify block <target> <targetPath> insert <index> string block <source> <sourcePath>/data modify block <target> <targetPath> insert <index> string block <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> insert <index> string entity <source>/data modify block <target> <targetPath> insert <index> string entity <source> <sourcePath>/data modify block <target> <targetPath> insert <index> string entity <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> insert <index> string storage <source>/data modify block <target> <targetPath> insert <index> string storage <source> <sourcePath>/data modify block <target> <targetPath> insert <index> string storage <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> insert <index> value <value>/data modify block <target> <targetPath> merge compute block <computePos> float <provider>/data modify block <target> <targetPath> merge compute block <computePos> integer <provider>/data modify block <target> <targetPath> merge compute default float <provider>/data modify block <target> <targetPath> merge compute default integer <provider>/data modify block <target> <targetPath> merge compute entity <computeTarget> float <provider>/data modify block <target> <targetPath> merge compute entity <computeTarget> integer <provider>/data modify block <target> <targetPath> merge from block <source> [<sourcePath>]/data modify block <target> <targetPath> merge from entity <source> [<sourcePath>]/data modify block <target> <targetPath> merge from storage <source> [<sourcePath>]/data modify block <target> <targetPath> merge string block <source>/data modify block <target> <targetPath> merge string block <source> <sourcePath>/data modify block <target> <targetPath> merge string block <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> merge string entity <source>/data modify block <target> <targetPath> merge string entity <source> <sourcePath>/data modify block <target> <targetPath> merge string entity <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> merge string storage <source>/data modify block <target> <targetPath> merge string storage <source> <sourcePath>/data modify block <target> <targetPath> merge string storage <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> merge value <value>/data modify block <target> <targetPath> prepend compute block <computePos> float <provider>/data modify block <target> <targetPath> prepend compute block <computePos> integer <provider>/data modify block <target> <targetPath> prepend compute default float <provider>/data modify block <target> <targetPath> prepend compute default integer <provider>/data modify block <target> <targetPath> prepend compute entity <computeTarget> float <provider>/data modify block <target> <targetPath> prepend compute entity <computeTarget> integer <provider>/data modify block <target> <targetPath> prepend from block <source> [<sourcePath>]/data modify block <target> <targetPath> prepend from entity <source> [<sourcePath>]/data modify block <target> <targetPath> prepend from storage <source> [<sourcePath>]/data modify block <target> <targetPath> prepend string block <source>/data modify block <target> <targetPath> prepend string block <source> <sourcePath>/data modify block <target> <targetPath> prepend string block <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> prepend string entity <source>/data modify block <target> <targetPath> prepend string entity <source> <sourcePath>/data modify block <target> <targetPath> prepend string entity <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> prepend string storage <source>/data modify block <target> <targetPath> prepend string storage <source> <sourcePath>/data modify block <target> <targetPath> prepend string storage <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> prepend value <value>/data modify block <target> <targetPath> set compute block <computePos> float <provider>/data modify block <target> <targetPath> set compute block <computePos> integer <provider>/data modify block <target> <targetPath> set compute default float <provider>/data modify block <target> <targetPath> set compute default integer <provider>/data modify block <target> <targetPath> set compute entity <computeTarget> float <provider>/data modify block <target> <targetPath> set compute entity <computeTarget> integer <provider>/data modify block <target> <targetPath> set from block <source> [<sourcePath>]/data modify block <target> <targetPath> set from entity <source> [<sourcePath>]/data modify block <target> <targetPath> set from storage <source> [<sourcePath>]/data modify block <target> <targetPath> set string block <source>/data modify block <target> <targetPath> set string block <source> <sourcePath>/data modify block <target> <targetPath> set string block <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> set string entity <source>/data modify block <target> <targetPath> set string entity <source> <sourcePath>/data modify block <target> <targetPath> set string entity <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> set string storage <source>/data modify block <target> <targetPath> set string storage <source> <sourcePath>/data modify block <target> <targetPath> set string storage <source> <sourcePath> <start> [<end>]/data modify block <target> <targetPath> set value <value>/data modify entity <target> <targetPath> append compute block <computePos> float <provider>/data modify entity <target> <targetPath> append compute block <computePos> integer <provider>/data modify entity <target> <targetPath> append compute default float <provider>/data modify entity <target> <targetPath> append compute default integer <provider>/data modify entity <target> <targetPath> append compute entity <computeTarget> float <provider>/data modify entity <target> <targetPath> append compute entity <computeTarget> integer <provider>/data modify entity <target> <targetPath> append from block <source> [<sourcePath>]/data modify entity <target> <targetPath> append from entity <source> [<sourcePath>]/data modify entity <target> <targetPath> append from storage <source> [<sourcePath>]/data modify entity <target> <targetPath> append string block <source>/data modify entity <target> <targetPath> append string block <source> <sourcePath>/data modify entity <target> <targetPath> append string block <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> append string entity <source>/data modify entity <target> <targetPath> append string entity <source> <sourcePath>/data modify entity <target> <targetPath> append string entity <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> append string storage <source>/data modify entity <target> <targetPath> append string storage <source> <sourcePath>/data modify entity <target> <targetPath> append string storage <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> append value <value>/data modify entity <target> <targetPath> insert <index> compute block <computePos> float <provider>/data modify entity <target> <targetPath> insert <index> compute block <computePos> integer <provider>/data modify entity <target> <targetPath> insert <index> compute default float <provider>/data modify entity <target> <targetPath> insert <index> compute default integer <provider>/data modify entity <target> <targetPath> insert <index> compute entity <computeTarget> float <provider>/data modify entity <target> <targetPath> insert <index> compute entity <computeTarget> integer <provider>/data modify entity <target> <targetPath> insert <index> from block <source> [<sourcePath>]/data modify entity <target> <targetPath> insert <index> from entity <source> [<sourcePath>]/data modify entity <target> <targetPath> insert <index> from storage <source> [<sourcePath>]/data modify entity <target> <targetPath> insert <index> string block <source>/data modify entity <target> <targetPath> insert <index> string block <source> <sourcePath>/data modify entity <target> <targetPath> insert <index> string block <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> insert <index> string entity <source>/data modify entity <target> <targetPath> insert <index> string entity <source> <sourcePath>/data modify entity <target> <targetPath> insert <index> string entity <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> insert <index> string storage <source>/data modify entity <target> <targetPath> insert <index> string storage <source> <sourcePath>/data modify entity <target> <targetPath> insert <index> string storage <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> insert <index> value <value>/data modify entity <target> <targetPath> merge compute block <computePos> float <provider>/data modify entity <target> <targetPath> merge compute block <computePos> integer <provider>/data modify entity <target> <targetPath> merge compute default float <provider>/data modify entity <target> <targetPath> merge compute default integer <provider>/data modify entity <target> <targetPath> merge compute entity <computeTarget> float <provider>/data modify entity <target> <targetPath> merge compute entity <computeTarget> integer <provider>/data modify entity <target> <targetPath> merge from block <source> [<sourcePath>]/data modify entity <target> <targetPath> merge from entity <source> [<sourcePath>]/data modify entity <target> <targetPath> merge from storage <source> [<sourcePath>]/data modify entity <target> <targetPath> merge string block <source>/data modify entity <target> <targetPath> merge string block <source> <sourcePath>/data modify entity <target> <targetPath> merge string block <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> merge string entity <source>/data modify entity <target> <targetPath> merge string entity <source> <sourcePath>/data modify entity <target> <targetPath> merge string entity <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> merge string storage <source>/data modify entity <target> <targetPath> merge string storage <source> <sourcePath>/data modify entity <target> <targetPath> merge string storage <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> merge value <value>/data modify entity <target> <targetPath> prepend compute block <computePos> float <provider>/data modify entity <target> <targetPath> prepend compute block <computePos> integer <provider>/data modify entity <target> <targetPath> prepend compute default float <provider>/data modify entity <target> <targetPath> prepend compute default integer <provider>/data modify entity <target> <targetPath> prepend compute entity <computeTarget> float <provider>/data modify entity <target> <targetPath> prepend compute entity <computeTarget> integer <provider>/data modify entity <target> <targetPath> prepend from block <source> [<sourcePath>]/data modify entity <target> <targetPath> prepend from entity <source> [<sourcePath>]/data modify entity <target> <targetPath> prepend from storage <source> [<sourcePath>]/data modify entity <target> <targetPath> prepend string block <source>/data modify entity <target> <targetPath> prepend string block <source> <sourcePath>/data modify entity <target> <targetPath> prepend string block <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> prepend string entity <source>/data modify entity <target> <targetPath> prepend string entity <source> <sourcePath>/data modify entity <target> <targetPath> prepend string entity <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> prepend string storage <source>/data modify entity <target> <targetPath> prepend string storage <source> <sourcePath>/data modify entity <target> <targetPath> prepend string storage <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> prepend value <value>/data modify entity <target> <targetPath> set compute block <computePos> float <provider>/data modify entity <target> <targetPath> set compute block <computePos> integer <provider>/data modify entity <target> <targetPath> set compute default float <provider>/data modify entity <target> <targetPath> set compute default integer <provider>/data modify entity <target> <targetPath> set compute entity <computeTarget> float <provider>/data modify entity <target> <targetPath> set compute entity <computeTarget> integer <provider>/data modify entity <target> <targetPath> set from block <source> [<sourcePath>]/data modify entity <target> <targetPath> set from entity <source> [<sourcePath>]/data modify entity <target> <targetPath> set from storage <source> [<sourcePath>]/data modify entity <target> <targetPath> set string block <source>/data modify entity <target> <targetPath> set string block <source> <sourcePath>/data modify entity <target> <targetPath> set string block <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> set string entity <source>/data modify entity <target> <targetPath> set string entity <source> <sourcePath>/data modify entity <target> <targetPath> set string entity <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> set string storage <source>/data modify entity <target> <targetPath> set string storage <source> <sourcePath>/data modify entity <target> <targetPath> set string storage <source> <sourcePath> <start> [<end>]/data modify entity <target> <targetPath> set value <value>/data modify storage <target> <targetPath> append compute block <computePos> float <provider>/data get entity <target> <path> [<scale>]/data get block <target>/data get storage <target> <path> [<scale>]/data merge entity <target> <nbt>/data merge block <target> <nbt>/data modify block <target> <targetPath> append from entity <source> [<sourcePath>]/data modify block <target> <targetPath> append value <value>/data modify block <target> <targetPath> insert <index> string entity <source> <sourcePath> <start> [<end>]| Argument | Type | What it means |
|---|---|---|
<target> | block position | The block position (three coordinates x y z), single-entity target selector (@p, @e, @s, player name, or UUID), or namespaced resource ID (such as minecraft:stone) you want to read or change. |
<path> | NBT path | The NBT path pointing to a specific piece of data, such as Inventory[0].id. |
<scale> | decimal number | A decimal number, such as 1.25, used to multiply a numeric value before returning it. |
<target> | target selector one target | The block position (three coordinates x y z), single-entity target selector (@p, @e, @s, player name, or UUID), or namespaced resource ID (such as minecraft:stone) you want to read or change. |
<target> | resource ID | The block position (three coordinates x y z), single-entity target selector (@p, @e, @s, player name, or UUID), or namespaced resource ID (such as minecraft:stone) you want to read or change. |
<nbt> | NBT compound | An NBT compound written inside curly braces, such as {NoAI:1b}. |
<targetPath> | NBT path | The NBT path on the target block where the modification will happen. |
<computePos> | block position | Three block coordinates (x y z, using ~ or ^) used as the position context when computing a value. |
<provider> | context float provider | A context float provider or context int provider used to calculate a numeric value. |
<provider> | context int provider | A context float provider or context int provider used to calculate a numeric value. |
<computeTarget> | target selector one target | A single-entity target selector or player name used as the entity context when computing a value. |
<source> | block position | The block position, single-entity target selector, or namespaced resource ID from which data is copied. |
<sourcePath> | NBT path | The NBT path on the source indicating which specific value to copy. |
<source> | target selector one target | The block position, single-entity target selector, or namespaced resource ID from which data is copied. |
<source> | resource ID | The block position, single-entity target selector, or namespaced resource ID from which data is copied. |
<start> | whole number | A whole number marking the starting character position when reading part of a string. |
<end> | whole number | A whole number marking the ending character position when slicing a string. |
<value> | NBT value | Any valid NBT value that you want to write directly into the target path. |
<index> | whole number | A whole number, such as 5 or -3, telling the game which list position to insert the data into. |
/data get entity @p Inventory[0].idChecks the item ID stored in the first occupied inventory slot of the nearest player.
/data get block 100 64 -20Reads and prints all the NBT data of the block located at coordinates 100, 64, -20.
/data get storage minecraft:stoneDisplays all the NBT data saved inside the minecraft:stone storage namespace.
/data merge entity @s {NoAI:1b}Merges the NoAI tag into the entity executing the command.
/data merge block ~ ~-1 ~ {Items:[]}Empties the Items list of the container block directly beneath you by merging an empty list.
/data modify block ~ ~1 ~ Items append from entity @a[limit=1] Inventory[0]Copies the first inventory item from a player and appends it to the Items list of the block above.
/data modify block 12 70 12 Items append value {Slot:0b,id:"minecraft:stone",count:1}Appends a single stone item compound directly into the Items list of the block at 12, 70, 12.
/data modify block ~2 ~ ~ Items insert 0 from storage minecraft:stone SavedItemTakes the SavedItem tag from minecraft:stone storage and inserts it at index 0 of the block two blocks east.
Measured from the game files of every Java release from 1.13 to 26.3.
+ /data get block <target>+ /data get block <target> <path> [<scale>]+ /data merge block <target> <nbt>+ /data modify block <target> <targetPath> append compute block <computePos> float <provider>+ /data modify block <target> <targetPath> append compute block <computePos> integer <provider>+ /data modify block <target> <targetPath> append compute default float <provider>− /data get block <targetPos>− /data get block <targetPos> <path> [<scale>]− /data merge block <targetPos> <nbt>− /data modify block <targetPos> <targetPath> append from block <sourcePos> [<sourcePath>]− /data modify block <targetPos> <targetPath> append from entity <source> [<sourcePath>]− /data modify block <targetPos> <targetPath> append from storage <source> [<sourcePath>]and 296 more+ /data modify block <targetPos> <targetPath> append string block <sourcePos>+ /data modify block <targetPos> <targetPath> append string block <sourcePos> <sourcePath>+ /data modify block <targetPos> <targetPath> append string block <sourcePos> <sourcePath> <start> [<end>]+ /data modify block <targetPos> <targetPath> append string entity <source>+ /data modify block <targetPos> <targetPath> append string entity <source> <sourcePath>+ /data modify block <targetPos> <targetPath> append string entity <source> <sourcePath> <start> [<end>]and 129 more+ /data get storage <target>+ /data get storage <target> <path> [<scale>]+ /data merge storage <target> <nbt>+ /data modify block <targetPos> <targetPath> append from storage <source> [<sourcePath>]+ /data modify block <targetPos> <targetPath> insert <index> from storage <source> [<sourcePath>]+ /data modify block <targetPos> <targetPath> merge from storage <source> [<sourcePath>]and 28 more+ /data get block <targetPos>+ /data get block <targetPos> <path> [<scale>]+ /data merge block <targetPos> <nbt>+ /data modify block <targetPos> <targetPath> append from block <sourcePos> [<sourcePath>]+ /data modify block <targetPos> <targetPath> append from entity <source> [<sourcePath>]+ /data modify block <targetPos> <targetPath> append value <value>− /data get block <pos>− /data get block <pos> <path> [<scale>]− /data merge block <pos> <nbt>− /data remove block <pos> <path>and 28 moreMinecraft Bedrock Edition does not have a /data command, so you cannot directly inspect or modify raw NBT paths on blocks, entities, or storage through commands in that edition.
You need permission level 2 to run /data, which means you must be a server operator or have cheats enabled in your single-player world.
The ability to use storage with /data get, /data merge, and /data modify was added in Java Edition 1.15.
The entity selector for /data only accepts one target at a time, so you must use @p, @s, a player name, or add [limit=1] to selectors like @e and @a.
/bossbar/execute/function/random/return/schedule/scoreboard/tag/team/trigger