/data Command in Minecraft Java Edition

Get, Merge, and Modify NBT Data

Java EditionLogic & ScoreboardPermission: Level 2

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.

Syntax (Java 26.3, 297 forms)

  1. /data get block <target>
  2. /data get block <target> <path> [<scale>]
  3. /data get entity <target>
  4. /data get entity <target> <path> [<scale>]
  5. /data get storage <target>
  6. /data get storage <target> <path> [<scale>]
  7. /data merge block <target> <nbt>
  8. /data merge entity <target> <nbt>
  9. /data merge storage <target> <nbt>
  10. /data modify block <target> <targetPath> append compute block <computePos> float <provider>
  11. /data modify block <target> <targetPath> append compute block <computePos> integer <provider>
  12. /data modify block <target> <targetPath> append compute default float <provider>
  13. /data modify block <target> <targetPath> append compute default integer <provider>
  14. /data modify block <target> <targetPath> append compute entity <computeTarget> float <provider>
  15. /data modify block <target> <targetPath> append compute entity <computeTarget> integer <provider>
  16. /data modify block <target> <targetPath> append from block <source> [<sourcePath>]
  17. /data modify block <target> <targetPath> append from entity <source> [<sourcePath>]
  18. /data modify block <target> <targetPath> append from storage <source> [<sourcePath>]
  19. /data modify block <target> <targetPath> append string block <source>
  20. /data modify block <target> <targetPath> append string block <source> <sourcePath>
  21. /data modify block <target> <targetPath> append string block <source> <sourcePath> <start> [<end>]
  22. /data modify block <target> <targetPath> append string entity <source>
  23. /data modify block <target> <targetPath> append string entity <source> <sourcePath>
  24. /data modify block <target> <targetPath> append string entity <source> <sourcePath> <start> [<end>]
  25. /data modify block <target> <targetPath> append string storage <source>
  26. /data modify block <target> <targetPath> append string storage <source> <sourcePath>
  27. /data modify block <target> <targetPath> append string storage <source> <sourcePath> <start> [<end>]
  28. /data modify block <target> <targetPath> append value <value>
  29. /data modify block <target> <targetPath> insert <index> compute block <computePos> float <provider>
  30. /data modify block <target> <targetPath> insert <index> compute block <computePos> integer <provider>
  31. /data modify block <target> <targetPath> insert <index> compute default float <provider>
  32. /data modify block <target> <targetPath> insert <index> compute default integer <provider>
  33. /data modify block <target> <targetPath> insert <index> compute entity <computeTarget> float <provider>
  34. /data modify block <target> <targetPath> insert <index> compute entity <computeTarget> integer <provider>
  35. /data modify block <target> <targetPath> insert <index> from block <source> [<sourcePath>]
  36. /data modify block <target> <targetPath> insert <index> from entity <source> [<sourcePath>]
  37. /data modify block <target> <targetPath> insert <index> from storage <source> [<sourcePath>]
  38. /data modify block <target> <targetPath> insert <index> string block <source>
  39. /data modify block <target> <targetPath> insert <index> string block <source> <sourcePath>
  40. /data modify block <target> <targetPath> insert <index> string block <source> <sourcePath> <start> [<end>]
  41. /data modify block <target> <targetPath> insert <index> string entity <source>
  42. /data modify block <target> <targetPath> insert <index> string entity <source> <sourcePath>
  43. /data modify block <target> <targetPath> insert <index> string entity <source> <sourcePath> <start> [<end>]
  44. /data modify block <target> <targetPath> insert <index> string storage <source>
  45. /data modify block <target> <targetPath> insert <index> string storage <source> <sourcePath>
  46. /data modify block <target> <targetPath> insert <index> string storage <source> <sourcePath> <start> [<end>]
  47. /data modify block <target> <targetPath> insert <index> value <value>
  48. /data modify block <target> <targetPath> merge compute block <computePos> float <provider>
  49. /data modify block <target> <targetPath> merge compute block <computePos> integer <provider>
  50. /data modify block <target> <targetPath> merge compute default float <provider>
  51. /data modify block <target> <targetPath> merge compute default integer <provider>
  52. /data modify block <target> <targetPath> merge compute entity <computeTarget> float <provider>
  53. /data modify block <target> <targetPath> merge compute entity <computeTarget> integer <provider>
  54. /data modify block <target> <targetPath> merge from block <source> [<sourcePath>]
  55. /data modify block <target> <targetPath> merge from entity <source> [<sourcePath>]
  56. /data modify block <target> <targetPath> merge from storage <source> [<sourcePath>]
  57. /data modify block <target> <targetPath> merge string block <source>
  58. /data modify block <target> <targetPath> merge string block <source> <sourcePath>
  59. /data modify block <target> <targetPath> merge string block <source> <sourcePath> <start> [<end>]
  60. /data modify block <target> <targetPath> merge string entity <source>
  61. /data modify block <target> <targetPath> merge string entity <source> <sourcePath>
  62. /data modify block <target> <targetPath> merge string entity <source> <sourcePath> <start> [<end>]
  63. /data modify block <target> <targetPath> merge string storage <source>
  64. /data modify block <target> <targetPath> merge string storage <source> <sourcePath>
  65. /data modify block <target> <targetPath> merge string storage <source> <sourcePath> <start> [<end>]
  66. /data modify block <target> <targetPath> merge value <value>
  67. /data modify block <target> <targetPath> prepend compute block <computePos> float <provider>
  68. /data modify block <target> <targetPath> prepend compute block <computePos> integer <provider>
  69. /data modify block <target> <targetPath> prepend compute default float <provider>
  70. /data modify block <target> <targetPath> prepend compute default integer <provider>
  71. /data modify block <target> <targetPath> prepend compute entity <computeTarget> float <provider>
  72. /data modify block <target> <targetPath> prepend compute entity <computeTarget> integer <provider>
  73. /data modify block <target> <targetPath> prepend from block <source> [<sourcePath>]
  74. /data modify block <target> <targetPath> prepend from entity <source> [<sourcePath>]
  75. /data modify block <target> <targetPath> prepend from storage <source> [<sourcePath>]
  76. /data modify block <target> <targetPath> prepend string block <source>
  77. /data modify block <target> <targetPath> prepend string block <source> <sourcePath>
  78. /data modify block <target> <targetPath> prepend string block <source> <sourcePath> <start> [<end>]
  79. /data modify block <target> <targetPath> prepend string entity <source>
  80. /data modify block <target> <targetPath> prepend string entity <source> <sourcePath>
  81. /data modify block <target> <targetPath> prepend string entity <source> <sourcePath> <start> [<end>]
  82. /data modify block <target> <targetPath> prepend string storage <source>
  83. /data modify block <target> <targetPath> prepend string storage <source> <sourcePath>
  84. /data modify block <target> <targetPath> prepend string storage <source> <sourcePath> <start> [<end>]
  85. /data modify block <target> <targetPath> prepend value <value>
  86. /data modify block <target> <targetPath> set compute block <computePos> float <provider>
  87. /data modify block <target> <targetPath> set compute block <computePos> integer <provider>
  88. /data modify block <target> <targetPath> set compute default float <provider>
  89. /data modify block <target> <targetPath> set compute default integer <provider>
  90. /data modify block <target> <targetPath> set compute entity <computeTarget> float <provider>
  91. /data modify block <target> <targetPath> set compute entity <computeTarget> integer <provider>
  92. /data modify block <target> <targetPath> set from block <source> [<sourcePath>]
  93. /data modify block <target> <targetPath> set from entity <source> [<sourcePath>]
  94. /data modify block <target> <targetPath> set from storage <source> [<sourcePath>]
  95. /data modify block <target> <targetPath> set string block <source>
  96. /data modify block <target> <targetPath> set string block <source> <sourcePath>
  97. /data modify block <target> <targetPath> set string block <source> <sourcePath> <start> [<end>]
  98. /data modify block <target> <targetPath> set string entity <source>
  99. /data modify block <target> <targetPath> set string entity <source> <sourcePath>
  100. /data modify block <target> <targetPath> set string entity <source> <sourcePath> <start> [<end>]
  101. /data modify block <target> <targetPath> set string storage <source>
  102. /data modify block <target> <targetPath> set string storage <source> <sourcePath>
  103. /data modify block <target> <targetPath> set string storage <source> <sourcePath> <start> [<end>]
  104. /data modify block <target> <targetPath> set value <value>
  105. /data modify entity <target> <targetPath> append compute block <computePos> float <provider>
  106. /data modify entity <target> <targetPath> append compute block <computePos> integer <provider>
  107. /data modify entity <target> <targetPath> append compute default float <provider>
  108. /data modify entity <target> <targetPath> append compute default integer <provider>
  109. /data modify entity <target> <targetPath> append compute entity <computeTarget> float <provider>
  110. /data modify entity <target> <targetPath> append compute entity <computeTarget> integer <provider>
  111. /data modify entity <target> <targetPath> append from block <source> [<sourcePath>]
  112. /data modify entity <target> <targetPath> append from entity <source> [<sourcePath>]
  113. /data modify entity <target> <targetPath> append from storage <source> [<sourcePath>]
  114. /data modify entity <target> <targetPath> append string block <source>
  115. /data modify entity <target> <targetPath> append string block <source> <sourcePath>
  116. /data modify entity <target> <targetPath> append string block <source> <sourcePath> <start> [<end>]
  117. /data modify entity <target> <targetPath> append string entity <source>
  118. /data modify entity <target> <targetPath> append string entity <source> <sourcePath>
  119. /data modify entity <target> <targetPath> append string entity <source> <sourcePath> <start> [<end>]
  120. /data modify entity <target> <targetPath> append string storage <source>
  121. /data modify entity <target> <targetPath> append string storage <source> <sourcePath>
  122. /data modify entity <target> <targetPath> append string storage <source> <sourcePath> <start> [<end>]
  123. /data modify entity <target> <targetPath> append value <value>
  124. /data modify entity <target> <targetPath> insert <index> compute block <computePos> float <provider>
  125. /data modify entity <target> <targetPath> insert <index> compute block <computePos> integer <provider>
  126. /data modify entity <target> <targetPath> insert <index> compute default float <provider>
  127. /data modify entity <target> <targetPath> insert <index> compute default integer <provider>
  128. /data modify entity <target> <targetPath> insert <index> compute entity <computeTarget> float <provider>
  129. /data modify entity <target> <targetPath> insert <index> compute entity <computeTarget> integer <provider>
  130. /data modify entity <target> <targetPath> insert <index> from block <source> [<sourcePath>]
  131. /data modify entity <target> <targetPath> insert <index> from entity <source> [<sourcePath>]
  132. /data modify entity <target> <targetPath> insert <index> from storage <source> [<sourcePath>]
  133. /data modify entity <target> <targetPath> insert <index> string block <source>
  134. /data modify entity <target> <targetPath> insert <index> string block <source> <sourcePath>
  135. /data modify entity <target> <targetPath> insert <index> string block <source> <sourcePath> <start> [<end>]
  136. /data modify entity <target> <targetPath> insert <index> string entity <source>
  137. /data modify entity <target> <targetPath> insert <index> string entity <source> <sourcePath>
  138. /data modify entity <target> <targetPath> insert <index> string entity <source> <sourcePath> <start> [<end>]
  139. /data modify entity <target> <targetPath> insert <index> string storage <source>
  140. /data modify entity <target> <targetPath> insert <index> string storage <source> <sourcePath>
  141. /data modify entity <target> <targetPath> insert <index> string storage <source> <sourcePath> <start> [<end>]
  142. /data modify entity <target> <targetPath> insert <index> value <value>
  143. /data modify entity <target> <targetPath> merge compute block <computePos> float <provider>
  144. /data modify entity <target> <targetPath> merge compute block <computePos> integer <provider>
  145. /data modify entity <target> <targetPath> merge compute default float <provider>
  146. /data modify entity <target> <targetPath> merge compute default integer <provider>
  147. /data modify entity <target> <targetPath> merge compute entity <computeTarget> float <provider>
  148. /data modify entity <target> <targetPath> merge compute entity <computeTarget> integer <provider>
  149. /data modify entity <target> <targetPath> merge from block <source> [<sourcePath>]
  150. /data modify entity <target> <targetPath> merge from entity <source> [<sourcePath>]
  151. /data modify entity <target> <targetPath> merge from storage <source> [<sourcePath>]
  152. /data modify entity <target> <targetPath> merge string block <source>
  153. /data modify entity <target> <targetPath> merge string block <source> <sourcePath>
  154. /data modify entity <target> <targetPath> merge string block <source> <sourcePath> <start> [<end>]
  155. /data modify entity <target> <targetPath> merge string entity <source>
  156. /data modify entity <target> <targetPath> merge string entity <source> <sourcePath>
  157. /data modify entity <target> <targetPath> merge string entity <source> <sourcePath> <start> [<end>]
  158. /data modify entity <target> <targetPath> merge string storage <source>
  159. /data modify entity <target> <targetPath> merge string storage <source> <sourcePath>
  160. /data modify entity <target> <targetPath> merge string storage <source> <sourcePath> <start> [<end>]
  161. /data modify entity <target> <targetPath> merge value <value>
  162. /data modify entity <target> <targetPath> prepend compute block <computePos> float <provider>
  163. /data modify entity <target> <targetPath> prepend compute block <computePos> integer <provider>
  164. /data modify entity <target> <targetPath> prepend compute default float <provider>
  165. /data modify entity <target> <targetPath> prepend compute default integer <provider>
  166. /data modify entity <target> <targetPath> prepend compute entity <computeTarget> float <provider>
  167. /data modify entity <target> <targetPath> prepend compute entity <computeTarget> integer <provider>
  168. /data modify entity <target> <targetPath> prepend from block <source> [<sourcePath>]
  169. /data modify entity <target> <targetPath> prepend from entity <source> [<sourcePath>]
  170. /data modify entity <target> <targetPath> prepend from storage <source> [<sourcePath>]
  171. /data modify entity <target> <targetPath> prepend string block <source>
  172. /data modify entity <target> <targetPath> prepend string block <source> <sourcePath>
  173. /data modify entity <target> <targetPath> prepend string block <source> <sourcePath> <start> [<end>]
  174. /data modify entity <target> <targetPath> prepend string entity <source>
  175. /data modify entity <target> <targetPath> prepend string entity <source> <sourcePath>
  176. /data modify entity <target> <targetPath> prepend string entity <source> <sourcePath> <start> [<end>]
  177. /data modify entity <target> <targetPath> prepend string storage <source>
  178. /data modify entity <target> <targetPath> prepend string storage <source> <sourcePath>
  179. /data modify entity <target> <targetPath> prepend string storage <source> <sourcePath> <start> [<end>]
  180. /data modify entity <target> <targetPath> prepend value <value>
  181. /data modify entity <target> <targetPath> set compute block <computePos> float <provider>
  182. /data modify entity <target> <targetPath> set compute block <computePos> integer <provider>
  183. /data modify entity <target> <targetPath> set compute default float <provider>
  184. /data modify entity <target> <targetPath> set compute default integer <provider>
  185. /data modify entity <target> <targetPath> set compute entity <computeTarget> float <provider>
  186. /data modify entity <target> <targetPath> set compute entity <computeTarget> integer <provider>
  187. /data modify entity <target> <targetPath> set from block <source> [<sourcePath>]
  188. /data modify entity <target> <targetPath> set from entity <source> [<sourcePath>]
  189. /data modify entity <target> <targetPath> set from storage <source> [<sourcePath>]
  190. /data modify entity <target> <targetPath> set string block <source>
  191. /data modify entity <target> <targetPath> set string block <source> <sourcePath>
  192. /data modify entity <target> <targetPath> set string block <source> <sourcePath> <start> [<end>]
  193. /data modify entity <target> <targetPath> set string entity <source>
  194. /data modify entity <target> <targetPath> set string entity <source> <sourcePath>
  195. /data modify entity <target> <targetPath> set string entity <source> <sourcePath> <start> [<end>]
  196. /data modify entity <target> <targetPath> set string storage <source>
  197. /data modify entity <target> <targetPath> set string storage <source> <sourcePath>
  198. /data modify entity <target> <targetPath> set string storage <source> <sourcePath> <start> [<end>]
  199. /data modify entity <target> <targetPath> set value <value>
  200. /data modify storage <target> <targetPath> append compute block <computePos> float <provider>

The forms you will use most

/data get entity <target> <path> [<scale>]
Reads a specific NBT path from a single entity and optionally multiplies numeric results by a scale.
/data get block <target>
Displays all the NBT data attached to the block at the given coordinates.
/data get storage <target> <path> [<scale>]
Reads data from a specific path inside a namespaced command storage ID.
/data merge entity <target> <nbt>
Combines your new NBT compound data with the existing data of a single target entity.
/data merge block <target> <nbt>
Combines new NBT compound data into the block located at the target position.
/data modify block <target> <targetPath> append from entity <source> [<sourcePath>]
Copies NBT data from an entity and adds it to the end of a list on a target block.
/data modify block <target> <targetPath> append value <value>
Adds a custom NBT value directly to the end of a list path on a block.
/data modify block <target> <targetPath> insert <index> string entity <source> <sourcePath> <start> [<end>]
Slices a substring from an entity NBT path and inserts it into a block list at a chosen index.

Arguments

ArgumentTypeWhat it means
<target>block positionThe 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 pathThe NBT path pointing to a specific piece of data, such as Inventory[0].id.
<scale>decimal numberA 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 IDThe 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 compoundAn NBT compound written inside curly braces, such as {NoAI:1b}.
<targetPath>NBT pathThe NBT path on the target block where the modification will happen.
<computePos>block positionThree block coordinates (x y z, using ~ or ^) used as the position context when computing a value.
<provider>context float providerA context float provider or context int provider used to calculate a numeric value.
<provider>context int providerA 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 positionThe block position, single-entity target selector, or namespaced resource ID from which data is copied.
<sourcePath>NBT pathThe 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 IDThe block position, single-entity target selector, or namespaced resource ID from which data is copied.
<start>whole numberA whole number marking the starting character position when reading part of a string.
<end>whole numberA whole number marking the ending character position when slicing a string.
<value>NBT valueAny valid NBT value that you want to write directly into the target path.
<index>whole numberA whole number, such as 5 or -3, telling the game which list position to insert the data into.

Examples

Version history

Measured from the game files of every Java release from 1.13 to 26.3.

  1. 26.3 Syntax changed.
    + /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
  2. 1.19.4 Syntax changed.
    + /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
  3. 1.15 Syntax changed.
    + /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
  4. 1.14 Syntax changed.
    + /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 more
  5. 1.13 Already in the game in 1.13, the oldest Java version we track.

Tips

Common mistakes

Java vs Bedrock

Minecraft 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.

FAQ

Who can run the /data command in Minecraft?

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.

When was command storage added to /data?

The ability to use storage with /data get, /data merge, and /data modify was added in Java Edition 1.15.

Why does my /data entity command say only one entity is allowed?

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.

Related commands

/bossbar/execute/function/random/return/schedule/scoreboard/tag/team/trigger