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
| Command | Description |
|---|---|
| > | 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
| Control | Description |
|---|---|
| Run | Execute the program at full speed (respects speed slider) |
| Step | Execute a single instruction and pause |
| Pause | Pause a running program |
| Reset | Stop execution and clear all state |
| Speed slider | Control execution speed (1 to 10,000 steps per frame) |
| Cell size | Choose 8-bit, 16-bit, or 32-bit cells |
| Input mode | Toggle between pre-filled input buffer and interactive input |
| Save & Share | Save 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
| Size | Range | Notes |
|---|---|---|
| 8-bit (default) | 0 – 255 | Classic Brainfuck. Most programs expect this. |
| 16-bit | 0 – 65,535 | Larger range, useful for arithmetic-heavy programs. |
| 32-bit | 0 – 4,294,967,295 | Maximum 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
| Pattern | Description |
|---|---|
| [-] | 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) |