Video Games

How to write a macro in World of Warcraft

November 20, 2026

Open the macro window with Escape, then Macros, or by typing /macro in chat; press New, name it, pick an icon, and type commands one per line, each starting with a slash. A macro can cast one spell per press and can choose which one with conditions in square brackets. The limits that shape every macro: one global cooldown per press, 255 characters, and no decisions the game would not let you make by hand.

The facts below are documented for the current retail game. World of Warcraft: Forever uses the same macro system as far as Blizzard has said, with one Forever-specific statement quoted at the end.

Opening the editor

"Open the Game Menu (Shortcut Esc) and then select Macros", or "Type /macro in the chat box and hitting Enter" (Wowhead, Macro Guide). Then "press the New button. By doing so you open a new window in which you must name your macro and select an icon for it." Two tabs hold two pools: "an account might have 120 macros saved, plus 18 macros saved for each character. Account macros, as the name indicates, are shared by all your characters". They live on Blizzard's side, so "you can access it from different computers and still retain all macros created."

Drag the finished macro to an action bar slot, and it fires from that slot's key like any ability; How to set up a keybinding in World of Warcraft covers the key.

The rules

"All macro commands start with a forward slash ( / ) to separate them from normal text actions" (Wowhead). The command that matters most is "/cast", which "Casts the spell with the name input after it from your spell book. (i.e. /cast Fireball )"; "/use" does the same for items, "/use 14 to use your second trinket" (same guide).

Three limits are the ones that stop macros doing what people hope:

  • "Macros can only trigger one global cooldown. When the global cooldown is triggered, it cancels the remainder of the macro" (Wowhead). A macro that lists three attacks casts the first and stops.

  • "Macros cannot be programmed to make decisions for the player, like 'heal the target with least HP'" (Wowhead), and "Macros cannot simulate additional keypresses. One keypress = one action" (Macros: Essential Information, a player-written sticky on Blizzard's forums).

  • "Macros cannot be any longer than 255 characters" (same sticky). The limit comes from the player-written guide, which also notes that the old workarounds "have been eliminated in 11.0". Blizzard's own support pages were not readable at the time of writing.

Conditions

A condition sits in square brackets between the command and the spell: "You can also have modifiers on spell casts that will appear between the /cast command and the spell name within brackets ([])" (Wowhead). Several conditions in one bracket must all hold, "All conditions need all to be true to happen", and several brackets are tried in turn, "individual commands execute the first valid conditional, from left to right" (forum sticky). An empty pair of brackets is the fallback.

The guide's example: "/cast [@focus,exists,nodead,harm][]Fireball" will "cast the Fireball at your focus target if it exists, if it isn't dead and it is an enemy", and "Otherwise the cast will happen on your current target."

ConditionTrue when
combat"you're in combat"
exists"the target for the cast exists"
dead, nodeadthe target is dead, or is not
harm, helpthe target "is an enemy", or "you can aid the target"
mounted"you are currently mounted"
mod:shift, mod:ctrl, mod:alt"the keybind was pressed while the SHIFT key was pressed", and so on
known:spellName"your character knows how to cast a certain spell"

All from the Wowhead table. "@" names the target of the cast: "@focus Targets the focus target", "@mouseover Targets the spell on the target that the mouse is currently hovering", and "@ (read 'at') can be replaced by target= in every command". Prefix "no" to invert any condition. A bare [mod] "will register any modifier, while [mod:shift] will only register shift" (forum sticky), and modifiers combine: "[mod:ctrlalt]".

Put "#showtooltip" on the first line "to have the macro behave as if it was the ability from the spellbook itself", showing the resolved spell's icon and tooltip (Wowhead).

Three macros worth having

A mouseover heal that falls back to your target:

#showtooltip
/cast [@mouseover,help,nodead][help][@player] Flash Heal

An attack that becomes a heal when you target a friend, from the forum sticky: "#showtooltip /cast [harm]Smite;Flash Heal", which "will use Smite if you have an enemy targeted, and Flash Heal otherwise". The semicolon separates the alternatives for one command.

An interrupt on your focus target, from Wowhead: "/cast [@focus] Kick".

What macros cannot replace

The sticky's list: "Macros cannot include a delay for most commands", and "/click" is "specifically blocked from being called in a macro, and needs to be manually typed in the chat window every time". A macro is a shortcut for choices you could make with the mouse, pressed once; it is not an addon, and How to install a World of Warcraft addon manually is where automation beyond that lives.

For World of Warcraft: Forever, Blizzard's beta notes contain one macro-specific line: "Players will once again be able to swap multiple weapons within the same GCD, for example via a macro to swap from a two-handed weapon, to a sword and shield" (Blizzard forums, WoW Forever Beta Development Notes). Everything else above is documented for retail and should be tested in Forever before relying on it.

Sources