Run these from an operator’s chat, a command block, or a function file. Execute is simplified here — chain the rows in the order you want them to run.

How to Use the Data Command Generator

  1. Open the Data tab.
  2. Pick a mode: get, merge, modify, or remove.
  3. Pick the target kind – block, entity, or storage – and fill in the target (a position for a block, a selector for an entity, or a namespaced ID for storage).
  4. For get, optionally set an NBT path and a scale multiplier. For merge, type raw NBT to merge directly onto the target. For modify, set a path, pick an operation (set, merge, append, prepend, or insert with an index), and provide a JSON value. For remove, just set the path to delete.
  5. Copy the generated /data command into a command block, function, or an operator’s chat.

Command Syntax Reference

/data get (block <pos>|entity <target>|storage <id>) [<path>] [<scale>]
/data merge (block <pos>|entity <target>|storage <id>) <nbt>
/data modify (block <pos>|entity <target>|storage <id>) <path> set|merge|append|prepend value <value>
/data modify (block <pos>|entity <target>|storage <id>) <path> insert <index> value <value>
/data remove (block <pos>|entity <target>|storage <id>) <path>

/data reads and writes raw NBT on the three kinds of targets that carry it: a block entity (chests, signs, command blocks – anything at a position with extra data), an entity (mobs, players, item entities, minecarts), or a command storage location (a namespaced, in-memory NBT store with no in-world position, e.g. mynamespace:mystorage, useful for holding intermediate values across commands). get is read-only and prints the value to chat/output, with an optional <scale> that multiplies a number before display – handy for converting raw tick or health values. merge writes NBT directly onto the target’s root with no path. modify is the most flexible write: it targets a specific path inside the NBT tree and can set (overwrite), merge (merge onto that path), append/prepend (add to the end/start of a list), or insert <index> (insert at a specific list position). remove deletes whatever’s at a path entirely.

Frequently Asked Questions

What’s the difference between /data merge and /data modify ... merge?

/data merge <target> <nbt> is a top-level mode that merges a whole compound of NBT directly onto the target’s root, with no path argument at all – good for quickly setting several tags at once, e.g. {Health:20,Fire:0}. /data modify <target> <path> merge value <value> is a modify operation that merges a value onto one specific path inside the tree, which matters when you need to reach a nested tag rather than the whole entity/block root.

What does storage mean as a target kind, if it’s not a block or entity?

Command storage is a namespaced, in-memory NBT container that doesn’t correspond to anything in the world – it exists purely to hold data across commands and functions, similar to a global variable. You reference it with an ID like mynamespace:mystorage, and it’s most often used with execute store to capture a command’s result, then read back out with /data get storage for further logic.

How is insert different from append and prepend in /data modify?

append always adds the value to the end of the list at that path, and prepend always adds it to the start. insert <index> lets you choose exactly where in the list the new value goes – index 0 inserts at the very front (same effect as prepend), while a higher index inserts further into the list, shifting everything after it back by one.

Why would I use /data get with a <scale> value?

Some NBT values are stored in units that aren’t directly meaningful – health is stored as a raw float, but so is remaining fire ticks or absorption. A scale multiplies the raw number before it’s printed or stored, letting you convert to a friendlier unit (e.g. multiplying a fractional value by 100 to get a percentage) without a separate scoreboard math step.

Can /data read or write NBT on a player, or just mobs and blocks?

Players are entities too, so /data get entity <player> and /data modify entity <player> ... both work – but Minecraft blocks writing certain protected player tags this way (like Inventory contents in some contexts) as a safety measure, since directly overwriting a player’s raw data can desync client and server state. For inventory-specific edits, the dedicated /item command is usually the safer, purpose-built tool.

Related Tools