Brainfuck is a minimalist esoteric programming language created by Urban Müller in 1993. It operates on a tape of memory cells using a data pointer, with only 8 commands. Despite its simplicity, it is Turing complete.
All data is stored as unsigned 8-bit integers (u8, range 0–255)
with wrapping arithmetic. Incrementing 255 gives 0; decrementing 0 gives 255.
A Brainfuck program consists of the 8 command characters listed below. All other characters are ignored and can be used as comments.
| Command | Description | Effect |
|---|---|---|
> | Move right | Increment the data pointer by one |
< | Move left | Decrement the data pointer by one |
+ | Increment | Increment the byte at the data pointer (wraps 255 → 0) |
- | Decrement | Decrement the byte at the data pointer (wraps 0 → 255) |
. | Output | Output the byte at the data pointer as an ASCII character |
, | Input | Read one byte of input into the cell at the data pointer (0 if no input) |
[ | Jump forward | If the byte at the data pointer is 0, jump to the matching ] |
] | Jump back | If the byte at the data pointer is nonzero, jump to the matching [ |
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-] >>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
,[.,]
++ Set cell 0 to 2 >+++ Set cell 1 to 3 <[->+<] Move cell 0 into cell 1 (addition) > Move to cell 1 (now 5) ++++++++++++++++++++++++++++++++++++++++++++++++. Add 48 for ASCII '5'
+++++++ Set cell 0 to 7
[>+++++++<-] Multiply into cell 1: 7×7 = 49 (ASCII '1')
Cell 0 is now 0
< (already at cell 0)
+++++ Set cell 0 to 5 (loop counter)
[ While cell 0 is nonzero
>.+ Print cell 1, then increment it
<- Decrement counter
]
u8 (0–255, wrapping)