Super Mario Bros controls and cheats

Everything below is read out of the game running on this page, so you can try any of it in the window without opening anything else.

Map Select
Map Select
Sound On
Sound On

Keyboard and gamepad

ActionKeyboardGamepad
Move left ← or A AXIS_LEFT, DPAD_LEFT
Move right → or D AXIS_RIGHT, DPAD_RIGHT
Jump ↑, W or Space FACE_1, DPAD_UP, left shoulder
Crouch / enter a pipe ↓ or S AXIS_DOWN, DPAD_DOWN
Run / throw fireball Shift or Ctrl FACE_1
Pause P START
Mute M

A controller works without any setup: plug it in, press a button, and the game picks it up. Both the D-pad and the left stick steer.

Remapping. Open Options above the game and use the key mapping panel: click a field, press the key you want, and it is saved in your browser. Nothing is sent anywhere and nothing needs an account.

On a phone the arrows appear on screen automatically. Hold the right-hand button to run, tap it to throw a fireball once you have a Fire Flower.

Two keys that are not in the menu

L — play as Luigi. Press L at any point and Mario is replaced by his brother. The choice is remembered between visits.

Q — press it seven times. The game starts distorting itself. Fourteen presses make it worse, twenty-one worse still, and after twenty-eight it stops pretending to be Super Mario Bros at all. Reload the page to get back.

Console cheats

The game exposes its own internals. Open the browser console (F12, or ⌥⌘J on a Mac), type displayCheats() for the built-in list, or paste any of these:

CommandWhat it does
game.playerShroom(game.player) Turn into Super Mario
game.playerStar(game.player) Star power
game.gainLife(Infinity) Unlimited lives
game.data.time.amount = Infinity; Stop the clock
game.setMap(4, 2); Jump to any level
game.setMapRandom(); Generate a random level
game.player.gravity = game.gravity /= 2; Half gravity
game.fastforward(2); Fast forward
game.lulz(); The same effect the Q key gives

If you only want to reach a particular stage, you do not need the console at all — every level has its own page that starts there: see all 32 levels. If you are on a machine where nothing can be installed, this page explains what actually runs.