Brainfuck text encoder
Type “Hi” and get a ready-to-run Brainfuck program of 107 characters, made only of plus signs and print dots. It also works the other way, running Brainfuck to show what a program prints and flagging unmatched brackets. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- Hi
- Calculation mode
- Encode
- Encoding
- brainfuck
- Input length
- 2
- Output length
- 107
This Brainfuck text encoder turns plain text into a working Brainfuck program that prints that text, and runs Brainfuck source the other way so you can see what a program prints. Encode mode walks each Latin-1 byte, adjusts a single tape cell with the shorter sequence of plus or minus on the wrapping 0–255 ring, and emits a period after every character so the program is immediately runnable. Decode mode is a classic eight-command interpreter on a bounded tape: it validates bracket matching before execution, ignores non-command characters the way traditional Brainfuck does, and fails clearly on unmatched brackets, step limits, or pointer overflow.
What Brainfuck is and what this tool returns
Brainfuck is a tiny esoteric language with eight commands that move a data pointer, increment or decrement the current cell, read or write a byte, and jump on zero or non-zero for loops. Despite the joke name, it is a complete model of computation that teachers, puzzle authors, and esolang hobbyists still use to explain tape machines, wrapping arithmetic, and the difference between syntax validation and runtime limits.
This page focuses on two practical jobs people actually search for: generate a Brainfuck program that prints a given string, and execute Brainfuck source to recover the printed output. Decode mode accepts any string of Brainfuck commands mixed with comments, because non-command characters are ignored by convention, but it refuses programs whose square brackets do not nest correctly.
What you can do with it
Classroom and esolang demos
Show how a tape machine prints a string by generating a short Brainfuck program and running it live without installing a local interpreter.
FAQ
What does the Brainfuck text encoder cost?
It is free in your browser on this page.
Which characters can I encode?
Latin-1 bytes with code points 0–255. Empty text yields an empty program.
What makes a Brainfuck program invalid?
Unmatched '[' or ']', moving the pointer past either end of the 30,000-cell tape, exceeding the step or output limits, or providing a non-string program field. Non-command characters are ignored, not rejected.
How do I find out what a Brainfuck program prints?
Switch to decode and paste the program. It runs on a bounded tape and shows the printed output; letters and other characters that are not commands are ignored, so comments inside the code are fine.
Can a Brainfuck program read input here?
Yes. You can supply optional input for the comma command, which reads one byte at a time. Once that input runs out, each further comma stores zero in the current cell.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/enc/brainfuck-encode \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Hi"}'const res = await fetch("https://api.kit.forhosting.com/enc/brainfuck-encode", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "Hi"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/brainfuck-encode",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "Hi"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/brainfuck-encode", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"Hi"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"Hi"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/brainfuck-encode", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "Hi"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.brainfuck_encode",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
The engine never calls a network, never samples randomness, and never depends on the calendar clock, so the same text and mode always produce the same result in the browser and through the API. Typical checks include encoding Hi to a short plus-dot program, running that program back to Hi, and rejecting a lone open bracket with invalid_input.
What Brainfuck is and what this tool returns
Encode mode supports Latin-1 bytes from zero through two hundred fifty-five so every character maps to one cell write and one print; code points above that range are rejected with a clear invalid_input message instead of silent mojibake. The JSON response always includes result for the generated program or the runtime output, mode echoing encode or decode, encoding fixed to brainfuck, and input_length plus output_length so automated tests can assert sizes without re-parsing the payload. Optional program_input supplies bytes for the comma command during decode; when stdin is exhausted, comma stores zero. There is no silent repair of bad brackets and no unbounded execution: step, tape, and output caps protect the Worker while keeping successful short programs fast and free in the browser.
How text and mode are read and how results stay reproducible
Encode rejects missing text, non-string values, strings longer than the documented character cap, and any character whose code point is greater than two hundred fifty-five, naming the index of the bad character so the caller can fix it. Decode rejects missing source, oversized programs, unmatched closing brackets, unmatched opening brackets, pointer moves past either end of the thirty-thousand-cell tape, outputs that grow past the output cap, and runs that exceed the step budget, which catches the classic infinite-loop patterns that would otherwise hang a free page. The preferred payload field is text, with aliases input, value, s, program, and message so forms, query strings, and SDK clients can reuse the same contract without renaming columns. Mode defaults to encode and accepts decode explicitly; aliases op, direction, and action map to the same switch, and run or execute are treated as decode for scripts that think of the second direction as execution rather than decryption. Because every branch is pure string assembly or a fixed interpreter loop, two clients with the same text, mode, and optional program_input receive byte-identical results across Worker versions as long as the generation rule and limits stay fixed. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing a Brainfuck generator yourself.
Where a Brainfuck encoder and runner fit in learning, puzzles, and tests
Students meet Brainfuck when a course introduces minimal instruction sets, when a club host runs an esolang night, or when a homework asks them to print Hello World without using a conventional language. Pair it with other text encoding helpers when you are building a small lab of free, deterministic utilities for education, security challenges, and ops smoke tests that should never depend on a network call or a model. On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a whiteboard demo to an automated pipeline without changing the encoded result.
Integration use cases
CTF and puzzle fixtures
Encode deterministic clues and verify player-submitted Brainfuck programs against expected printed output in automated checkers.
CI golden pairs
Assert encode and run results in continuous integration so generators and documentation samples never drift silently.
Technical questions
What modes are supported?
mode=encode (default) turns plain text into a Brainfuck program that prints it. mode=decode runs Brainfuck source and returns the printed output. Aliases run and execute also mean decode.
Is the result deterministic?
Yes. The same text, mode, and optional program_input always produce the same result with no network, randomness, or date-dependent behavior.