Set Max Health To 40 Hearts
Give yourself 20 permanent extra hearts
✅ Verified for Java 26.2 · Bedrock 26.32 — checked June 2026Sets your maximum health to 40 (20 hearts) instead of the default 20 (10 hearts). This is useful for creating harder survival challenges or testing damage mechanics. Changes persist until reset.
/attribute @s minecraft:max_health base set 40- Java: yes
- Bedrock: no
- Command block: yes
- Needs cheats / OP: yes
How to use
- Open chat (T on Java, / on Bedrock).
- Paste the command and press Enter.
- Your health bar expands to 20 hearts.
- You now take longer to defeat in combat.
Related commands
Set Gamemode to Creative
Switch yourself into Creative mode
Set Difficulty to Peaceful
Switch to Peaceful mode so hostile mobs don't spawn
Add Experience Levels
Give yourself or a player XP levels
Start a Thunder Storm
Trigger a thunderstorm with lightning
Set Time to Night
Make it nighttime immediately
Display World Seed
See the world seed for reproducibility or map info