Esoteric Programming Languages

Dr. Mathias Elsner

Remaining sane in insane times

Nomen est omen!

The name of the language says it all. It describes what this language does to the brain of developers who are so wanton to expose themselves to coding in brainfuck. In order to avoid firewall and proxy blocks or browser content filters, the language is sometimes referred to as brainf*ck, brainf*** or bf.

WTF is BF?

BF is the most elementary Turing complete programming language ever implemented. Simplified, Turing complete boils down to the fact, that with BF you can program a functional equivalent for every, really every program in any other language. From a practical point of view, you definitely would not want to go there. Yet everything that a machine can calculate at all, can be calculated using BF. BF can best be imagined as a simulation of a Turing machine (see page area to the right).

Write your own code here:

Sample code is available further down the page.


; oder ms

◀ Input 0, -1, or no change on EOF

◀ Memory tape

Output ▼


Sample code:

(Click button▼ to copy sample code to RUN area▲)


The most comfortable option to try out brainfuck is by using an online interpreter. I employ the nice Javascript by © Ian Osgood dating from 2015.

Turing Machine

An implementation of a bf Turing machine consists of (1) a [theoretically infinite] storage tape which is divided into discrete "squares" or "fields", i.e. cells containing one byte each; (2) a "read / write head" and (3) a "program", i.e. a sequence of bf commands. The commands control movement of the head and numeric manipulation of cell contents.


[Wikimedia 'Deniss' CCBYSA3.0]

For those who really (really!) want to delve deeply into the matter, Alan Turing's ingenious 1936 paper is heartily recommended.

Brainfuck Instructions

This is the complete alphabet:

  • >
    (move head right)
  • <
    (move head left)
  • +
    (increment current cell by 1)
  • -
    (decrement current cell by 1)
  • .
    (output ASCII character of current cell)
  • ,
    (ASCII user-Input to current cell)
  • [
    (jump beyond next ] if current cell = '0')
  • ]
    (jump to previous [ if current cell is NOT '0'))

All other characters are treated as comments.

Impressum ©2020 mathias.elsner

Sorry, these pages don't scale well on mobile devices...


I'm en route to extinction