XCODX |

Brainfuck Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About Brainfuck

Urban Müller wrote Brainfuck in 1993 while trying to build the smallest possible compiler for the Amiga, and its eight commands have defined the Turing tarpit genre ever since. The language exposes nothing but a tape of memory cells, a data pointer, and single-character instructions for moving, incrementing, looping, and byte I/O. It is the canonical first stop on the Esolang wiki, a fixture on Anarchy Golf and Code Golf Stack Exchange, and the ancestor of countless derivative languages. Running it on XCODX means a real terminal rather than a static output box: the comma instruction blocks on stdin, and you type your input live while the tape program is executing.

Hello World in Brainfuck

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
How it works: nested loops seed a few tape cells with useful starting values near the ASCII letter ranges; the pointer then walks from cell to cell nudging each value slightly before printing so every character of the greeting costs only a handful of instructions!

When to use Brainfuck

Brainfuck remains a rite of passage for esolang explorers and a live category on Anarchy Golf, where shaving single instructions off a solution is the whole sport. It is widely used in CS teaching to demonstrate Turing completeness from almost nothing, and writing a Brainfuck interpreter is itself a classic exercise. Golfers also study cell-value arithmetic here before tackling constant-generation problems in other tarpit languages.

Common questions

Is Brainfuck actually Turing complete?

Yes, given an unbounded tape. The combination of increment, decrement, pointer movement, and the conditional loop bracket pair is enough to simulate any Turing machine, which has been formally shown via translations from other complete models. Practical interpreters use finite tapes, commonly 30,000 cells, which is ample for real programs including compilers and interpreters written in Brainfuck itself.

What happens when a Brainfuck program reads input?

The comma command reads one byte from stdin into the current cell. Implementations differ on end-of-file behavior, typically storing 0, storing 255, or leaving the cell unchanged, so golfers check which convention an interpreter uses. In the XCODX terminal the read is genuinely interactive: execution pauses at the comma until you type a character.

Why do Brainfuck hello-world programs use nested loops?

Because reaching a value like 72 with bare plus signs costs 72 instructions. A loop acts as multiplication, so a counter of 8 that adds 9 to a neighbor builds 72 in far fewer commands. Golfed programs set up several cells at once inside one loop, then make small adjustments per character, which is why competitive hello worlds hover around one hundred instructions.

How Brainfuck runs on XCODX

Sandbox filename
main.bf
Entry point
single main source file
Editor grammar
text/x-brainfuck
Reading stdin
,
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.