Updated:
A rule book by version
| Version | Command |
|---|---|
| Java 1.21.5+ | /give @p minecraft:written_book[ |
| Java 1.20.5–1.21.4 | /give @p minecraft:written_book[ |
| Java 1.20.4 and earlier | /give @p minecraft:written_book{ |
Each entry in pages is one page. From 1.21.5 a page can be a plain string; before that every page is JSON text inside single quotes. Mixing the two gives an error or an empty book. Keep the title to 32 characters.
Colors and bold text
# Java 1.21.5+
/give @p minecraft:written_book[written_book_content={title:"News",author:"Admin",pages:[{text:"Event today!",color:"gold",bold:true}]}]
# Java 1.20.5–1.21.4
/give @p minecraft:written_book[written_book_content={title:"News",author:"Admin",pages:['{"text":"Event today!","color":"gold","bold":true}']}]
Color names are the same as for item names. To use several colors on one page, write a list: [{text:"Red ",color:"red"},.
Clickable pages
# Java 1.21.5+
/give @p minecraft:written_book[written_book_content={title:"Menu",author:"Admin",pages:[{text:"[Back to spawn]",color:"aqua",click_event:{action:"run_command",command:"/trigger lobby"}}]}]
# Java 1.21.4 and earlier (the click part)
{"text":"[Back to spawn]","clickEvent":{"action":"run_command","value":"/trigger lobby"}}
Clicking runs the command as the reader. Players without operator rights cannot run /tp and similar commands, so books for everyone should use /trigger. In 1.21.5 clickEvent became click_event and value became command.
To jump to another page, use click_event:{action:"change_page",page:3} (before 1.21.5: "clickEvent":{"action":"change_page","value":"3"}). This is handy for a table of contents.
A book players can still write in
# Java 1.20.5+
/give @p minecraft:writable_book[writable_book_content={pages:["Write your feedback here"]}]
A book and quill with starting text can still be edited and signed by the player, which works well for feedback forms or shared diaries.
Bedrock Edition
Bedrock's /give cannot set book contents. Write and sign the book in game, or store a chest of finished books with /structure and load it where you need copies.
Common problems
- Error when running: the format does not match your version, most often the page format before and after 1.21.5.
- The book shows "* Invalid book tag *": broken JSON on 1.20.4 or earlier. Check the quotes and brackets in each page.
- Clicking does nothing: the reader is not allowed to run that command. Use /trigger.
- Garbled text from a datapack: save the .mcfunction file as UTF-8.
Common questions
- How many pages? Up to 100 pages in a written book.
- Can the author be someone else? Yes, whatever you put in
authoris shown. - Line breaks? Pages wrap automatically. Put separate topics on separate pages.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.