Brainfuck Language Reference

Brainfuck is an esoteric programming language with only 8 commands. It operates on a tape of memory cells, each initially set to zero, and a pointer that starts at the first cell.

Overview

A Brainfuck program manipulates a linear tape of cells using a movable pointer. Each cell holds a numeric value. The language has exactly 8 instructions — all other characters are treated as comments.

Commands

CommandDescription
>Move the pointer one cell to the right
<Move the pointer one cell to the left
+Increment the value at the current cell by 1
-Decrement the value at the current cell by 1
.Output the value at the current cell as an ASCII character
,Read one byte of input and store it in the current cell
[If the current cell is 0, jump forward to the matching ]
]If the current cell is not 0, jump back to the matching [

Using the Editor

ControlDescription
RunExecute the program at full speed (respects speed slider)
StepExecute a single instruction and pause
PausePause a running program
ResetStop execution and clear all state
Speed sliderControl execution speed (1 to 10,000 steps per frame)
Cell sizeChoose 8-bit, 16-bit, or 32-bit cells
Input modeToggle between pre-filled input buffer and interactive input
Save & ShareSave the program and get a shareable URL

Visit the Gallery to try example programs. Clicking "Try it" loads the program into the editor.

Debugger

The tape visualizer shows the memory tape with the current pointer highlighted. During step-through execution, the current instruction is highlighted in the source code.

Use Step to advance one instruction at a time, or Run with a slow speed to watch execution in real time. The tape display auto-scrolls to follow the pointer.

Cell Sizes

SizeRangeNotes
8-bit (default)0 – 255Classic Brainfuck. Most programs expect this.
16-bit0 – 65,535Larger range, useful for arithmetic-heavy programs.
32-bit0 – 4,294,967,295Maximum range. Overflow wraps around.

All cell sizes use wrapping arithmetic: incrementing past the maximum wraps to 0, and decrementing below 0 wraps to the maximum value.

Example Patterns

PatternDescription
[-]Clear cell: decrement until zero
[->+<]Move: copy cell 0 to cell 1 (destructive)
[->+>+<<]>>[-<<+>>]Copy: duplicate cell 0 to cell 1 (non-destructive)
,[.,]Cat: echo all input to output
+++++++++++++++++++++++++++++++++.Print '!' (ASCII 33 = 33 increments)