LearnReference
Reference
Brainfuck is a programming language with eight commands, made by Urban Müller in 1993 for the Amiga computer [1]. It is a well-known “esoteric” language: one made to explore an idea, not to get work done [2]. To learn the language step by step, begin with Start here.
Brainfuck in five minutes
This program prints “Hello, World!” and a new line, in 136 commands. Press Play and raise the speed, or drag Step to any moment of the run, and watch the cells and the line “Printed”:
Notice cells 1 to 4: a loop filled them with 70, 100, 30 and 10, and the rest of the program nudged those numbers to the letters it needed. The machine has a long row of boxes, the tape. Each box, a cell, holds a number and starts at 0. A pointer marks one cell. A program is a line of commands, read from left to right. There are eight commands, and that is the whole language:
| Command | What it does | In C |
|---|---|---|
> | Move the pointer one cell to the right | p++; |
< | Move the pointer one cell to the left | p--; |
+ | Add one to the cell under the pointer | array[p]++; |
- | Take one off the cell under the pointer | array[p]--; |
. | Print the cell as one character | putchar(array[p]); |
, | Read one character into the cell | array[p]=getchar(); |
[ | Start of a loop: if the cell is 0, jump past the matching ] | while(array[p]) { |
] | End of a loop: go back to the matching [ | } |
Three more things and you know it all:
- Letters are numbers. A cell that holds 72 prints as "H", because 72 is the code for H in the ASCII table.
- A loop runs while the cell under the pointer is not 0. It is the only way to repeat something and the only way to decide something.
- Every other character is a comment. The README says it in one sentence: "All other characters are ignored." [1]
That the language is small does not make programs small. Printing thirteen characters took 136 commands in the program above. The shortest program known to print that greeting has 72 [3].
Look something up
- The language, preciselyThe eight commands, the tape, the pointer, input and output. With programs you can run.
- Where implementations differCell size, the ends of the tape, the end of the input. A compatibility table.
- HistoryUrban Müller, the Amiga, 1993, and a compiler of 240 bytes. With a timeline.
- TheoryWhy eight commands are enough, and what "Turing complete" does not mean.
- Writing real programsThinking in cells, the idioms, and tools that write brainfuck for you.
- Notable programsFrom "Hello, World!" in 72 commands to chat models of billions.
- ImplementationsHow interpreters and compilers work, and what makes them fast.
- RelativesThe languages before it and the many built on it.
- CultureWhy people do this, and where they meet.
- GlossaryEvery term, in a sentence or two.
- Questions people askIs it useful? Is it hard? What about the name? Where do I start?
- Further readingEvery source we cite, with a note on what it is good for.
Where this comes from
Much that is written about brainfuck is copied from somewhere else, errors included. The Reference rests on the 1993 package itself [1] and on the authors' own pages. Every source is numbered, and each was opened on 11 October 2026. Where the only source is a community wiki [4], the text says so. Each page ends with what could not be verified. The programs you can run here were written for this site; other people's programs are described and linked, not copied.
The name holds a swear word. It is written here as its author wrote it, in lower case [1]. Polite spellings are on the questions page.
Learn by doing
To learn the language rather than look things up, follow the path that begins on Start here. It has three parts, in this order:
- Brainfuck basicsTen short lessons on the language, one small task at a time.
- Build toward a chatbotEleven lessons, from the eight commands to one number of a chat model and choosing a word.
- The real programThree pages to read: Inside the program, the Program map and How it works.
Three more pages are for doing, under Play: write, copy, practise.
Read next
Notes and sources
Where a source is a community wiki or the author's own account, the entry or the text says so.
- Urban Müller, brainfuck-2.lha, Aminet, dev/lang, dated 9 June 1993: the package page on Aminet. We read the files in the archive:
README,bfc.asm(the compiler),bfi.c(the interpreter) and the six example programs. Sizes and dates are those of the archive listing. Opened 11 October 2026. - Esolang wiki, "Esoteric programming language": the wiki article on esoteric languages. Opened 11 October 2026.
- Code Golf Stack Exchange, answers to the "Hello, World!" challenge: the answer by KSab (27 April 2018, 72 bytes) and the answer by primo (3 January 2016, 78 bytes). Read through the Stack Exchange API. Opened 11 October 2026.
- Esolang wiki, "Brainfuck": the wiki article on brainfuck. A community wiki; we use it for conventions and for its list of results, and name it where it is our only source. Opened 11 October 2026.