/data Command Generator
BetaPick a mob, block or storage, a path and what to do. The preview shows a small example of that target's NBT as a tree, highlights the path you picked and plays the change from before to after.
Describe it — AI writes the command
Type what you want in plain words. The AI fills the form below, so you can see it and change anything. It follows the edition and version you picked.
Checking the AI…
Paste a command— edit it here or move it to another version
{8}
CustomName: {2}
Tags: [1]
equipment: {1}
mainhand: {2}
Your command · Java 26.3
77 characters/data modify entity @e[type=zombie,limit=1,sort=nearest] Health set value 40f
Raw editor
How it works
Some common jobs:
data get entity @s Health
data merge entity @e[type=zombie,limit=1,sort=nearest] {NoAI:1b,Silent:1b}
data modify entity @e[type=zombie,limit=1,sort=nearest] Health set value 40f
data modify storage my_pack:data saved.item set from entity @p SelectedItem
data modify block ~ ~-1 ~ Items append value {Slot:5b,id:"minecraft:diamond",count:3}
data remove block ~ ~-1 ~ Items[0]Paths
A path walks into the NBT: Items[0].count is the count of the first item, Items[-1] the last one, Items[] all of them, Items[{Slot:2b}] the one in slot 2, and quotes handle keys with spaces. Values are SNBT: numbers carry a type letter (1b, 20f, 300s), text goes in quotes. The generator checks the SNBT and tells you what is wrong.
Versions
/data arrived in Java 1.13 with get, merge and remove. modify came in 1.14, command storage in 1.15, and the string source (part of a text, such as the first 3 letters of a name) in 1.19.4, with negative positions counting from the end from 1.20. Item counts are Count:3b before 1.20.5 and count:3 after, and mob gear moved from HandItems/ArmorItems to equipment in 1.21.5, so check the path against your version. Bedrock has no NBT commands.
You can’t change a player’s NBT with /data: use /item, /attribute or /effect instead. /data also targets one entity at a time, so give selectors limit=1, or loop with /execute as … run data … entity @s.
FAQ
What is the difference between data merge and data modify?
merge mixes a whole compound into the target at once (data merge entity … {NoAI:1b}). modify changes one path, and can set, merge, append, prepend or insert a value, or copy it from another entity, block or storage.
Why can't I change player data?
The game blocks /data merge, modify and remove on players to keep their saves safe. You can still read it with data get. Use /item, /attribute, /xp or /effect to change players.
What is command storage?
A place to keep NBT that isn't attached to any entity or block, named like my_pack:data. It arrived in Java 1.15 and lasts with the world, so data packs use it as variables.
How do I get a number into a scoreboard?
execute store result score @s my_obj run data get entity @s Health. Add a scale to keep decimals: data get entity @s Health 10 turns 19.5 into 195.
Why does my path find nothing?
NBT names are case-sensitive and change between versions (Count became count in 1.20.5, HandItems became equipment in 1.21.5). Run data get entity @s with no path to see the real names.