Updated:

Give an elytra

/give @s minecraft:elytra

The same command works on Java and Bedrock (/give @s elytra also works on Bedrock). Replace @s with a name or @a to give it to others.

Unbreakable elytra (Java)

VersionCommand
1.20.5 and later/give @s minecraft:elytra[unbreakable={}]
1.20.4 and earlier/give @s minecraft:elytra{Unbreakable:1b}

A normal elytra loses 1 durability per second of flight and stops working at 1 durability, after about 432 seconds. Unbreakable means no repairs. Bedrock /give cannot make items unbreakable, so use mending there.

Mending and Unbreaking

VersionCommand
Java 1.21.5+/give @s minecraft:elytra[enchantments={mending:1,unbreaking:3}]
Java 1.20.5 to 1.21.4/give @s minecraft:elytra[enchantments={levels:{mending:1,unbreaking:3}}]
BedrockHold the elytra and run /enchant @s mending and /enchant @s unbreaking 3

Mending repairs the elytra with experience. More in the enchant guide.

Put it on directly

/item replace entity @s armor.chest with minecraft:elytra[unbreakable={}]

This fills the chest slot on Java 1.20.5+. Any chestplate you are wearing is deleted. On Bedrock use /replaceitem entity @s slot.armor.chest 0 elytra. See the /item guide.

Rockets for flying

VersionCommand
Java 1.20.5+/give @s minecraft:firework_rocket[fireworks={flight_duration:3}] 64
Java 1.20.4 and earlier/give @s minecraft:firework_rocket{Fireworks:{Flight:3}} 64

A higher flight_duration boosts you for longer; 3 is the most you can craft. Rockets without firework stars do not explode, so they are the safe choice for flying. Bedrock /give cannot set the duration, so craft rockets with 3 gunpowder. For colored fireworks see the firework guide.

How to fly

  1. Wear the elytra in the chest slot.
  2. Jump from somewhere high and press jump again while falling to open the wings.
  3. Use a rocket while gliding to speed up.

You can also open the wings by jumping twice on flat ground, but you land almost at once.

When it does not work

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.