The best site to learn and play with Brainfuck
The most complete site for Brainfuck study
Brainfuck is an esoteric programming language designed to challenge and amuse
programmers. Created by Urban Müller in 1993, its minimalistic design consists
of just eight commands, making it Turing-complete despite its extreme
simplicity.
The language operates on an array of memory cells, using a pointer to
manipulate data. Its intentionally obscure syntax—composed of symbols like <,
>, +, -, [, ], ., and ,—makes writing even simple programs a puzzle.
While impractical for real-world use, Brainfuck is a fascinating exploration
of computational minimalism and a fun exercise in low-level thinking.
Brainfuck programs use a memory stack of 8-bit cells (0–255). A pointer moves between cells, modifying their values with increment and decrement operations.
Increment pointed memory cell by 1
-Decrement pointed memory cell by 1
<Move pointer left (previous cell)
>Move pointer right (next cell)
Print pointed memory cell
,Ask for user input and insert in pointed memory cell
Memory cells store 8-bit values (0–255). To print them, the numeric value is
converted to a character using the ASCII table.
The same is done for when a character is inputed into a memory cell.
Start loop
]End loop
Loops simplify repetitive operations like incrementing or decrementing a memory cell.
When a loop starts, if the current cell is zero, it skips to the end. If the cell is
non-zero, the loop runs until the cell becomes zero again, at which point it exits
without returning to the start.
A common use for loops is multiplication. One cell acts as the multiplicand
(decrementing each iteration), while another acts as the multiplier (incrementing
repeatedly). This mimics how multiplication works—adding a number to itself multiple
times.
Loops can also zero out a cell quickly. For example, [-] keeps decrementing until the cell hits zero, while [+] increments until it reaches 255 and overflows to zero. This makes loops a
powerful tool for both arithmetic and memory management.
End program