BF interpreter


About the interpreter

The BF language (also known as brainfuck, brainf***, brainf*ck, brainfsck, b****fuck, brainf**k) is one of the best known esoteric programming languages. You can find more information about it at

The language closely resembles a simple turing machine that walks forward and backward along a tickertape-like arrangement of memory addresses, and increments or decrements them according to the programmed instructions.

It consists of a total of eight instructions, each consisting of a single character:

Our demonstration starts with a tape of a single empty cell (or memory addresses) but it will grow as necessary when the instructions run the tape off either end of the existing space. The memory limits and performance of the interpretter are limited only by your browser's javascript implementation and your machines hardware resources that are available to it. Google Chrome has the fastest javascript implementation and is recommended for performing some of the more processing intensive bf programs. Little code validation is done, so be aware that your browser could lock up if you have code that works hard or goes into an infinite loop. The best (or only) way to recover may be to close your browser and restart it. In some cases, simply closing the tab may be sufficient.

This tape shows the values of the individual registers as unsigned integers. You can change the bit depth via the drop down that accompanies the controls. According to "Brainfuck for Dummies" (should be available as a PDF if you search Google) the standard implementation is for 8 bits per cell. I have provided a simple way to change the bit depth by using the drop down where the run controls are. The other buttons reset the code (return cursor to start, clear the tape and the output) and allow you to step through the code per instruction or per line or run completely to end of file. Some programs aren't designed to be run to eof as they are set up as an infinite loop, the binary counter is one example.

For programs that take input, use "###" on a line by itself in the code window, the code will end before that line and anything after that line is read by the input mechanism. An eof (end of file/input) is read as a zero.

Other bf resources: