Where 'Foo' and 'Bar' Came From: A History of Placeholder Names
How foo, bar, and baz became the default placeholder names in code examples — the FUBAR slang theory, MIT hacker roots, and the other placeholder traditions worth knowing.
Open almost any programming tutorial and you will eventually meet foo and bar. They show up in function signatures, variable names, and example URLs, and nobody ever explains them. They are the dev world’s equivalent of “lorem ipsum” — names chosen precisely because they carry no meaning.
What a Metasyntactic Variable Actually Is
The technical term for foo and bar is a metasyntactic variable: a placeholder name used in examples when the specific name does not matter. The point is to signal “this could be anything” without distracting the reader with a name that looks meaningful.
def process(foo, bar): return foo + barIf that example used total and tax_rate, you would start reasoning about taxes. With foo and bar, your attention stays on the structure — the function takes two arguments and adds them. That deliberate emptiness is the whole job. When you need a third or fourth, the conventional next names are baz and then qux.
Different communities have their own placeholder dialects. Python documentation famously uses spam and eggs, a nod to the Monty Python sketch that also gave the language its name. Cryptography papers almost universally use Alice and Bob as the two parties exchanging messages, with Eve as the eavesdropper. Designers reach for lorem ipsum, scrambled pseudo-Latin, when they need filler text. Each tradition solves the same problem: a name that holds a slot without hijacking attention.
The Murky Origins of Foo and Bar
Here is where honesty matters more than a tidy story. The exact origin of foo is genuinely contested, and anyone who tells you they know for certain is overselling it.
What is reasonably well documented is that foo existed as a nonsense word well before computers. It appeared in early-20th-century comics and cartoons — the Smokey Stover comic strip from the 1930s sprinkled “foo” everywhere as gag text — so the word was already floating around American pop culture as cheerful nonsense.
The leading theory for foobar specifically connects it to the WWII-era military slang FUBAR, an acronym whose polite expansion is “Fouled Up Beyond All Recognition.” The idea is that engineers familiar with the term started writing “foobar” in examples, and it naturally split into the pair foo and bar. This is plausible and widely repeated, but the causal direction — did FUBAR create foobar, or did an existing “foo” just collide with the acronym? — is not settled.
What is clearer is where the pairing took hold: mid-20th-century engineering and hacker culture, especially around MIT. The terms appear in railroad-club and early computing slang from the 1950s and 60s, and they were carried forward by generations of programmers writing manuals, mailing lists, and textbooks. Repetition, not invention, is what made them universal.
Why the Convention Survives
The reason these names persist is not nostalgia — it is that meaningless placeholders are genuinely useful. A good example name should be recognizably fake so no reader mistakes it for something domain-specific. foo and bar are instantly recognized by experienced developers as “ignore the name, watch the mechanics,” which is a small but real act of communication.
There is even a semi-official write-up: the Internet Engineering Task Force published an April Fools’ RFC titled “The Etymology of ‘Foo’” (RFC 3092) that catalogs the term’s uses and theories. As an April 1st RFC it is half tongue-in-cheek, but it does collect the real folklore in one place — a sign of how seriously the community takes its own in-jokes.
So the next time you type foo, you are participating in a tradition that runs from 1930s comic strips through wartime slang and MIT terminals into your editor. It means nothing, deliberately, and that is exactly why it has lasted.
FAQ
A few common questions about placeholder names and how to use them.
FAQ
What comes after foo, bar, and baz?+
Is foobar really from the military term FUBAR?+
When should I use foo and bar in real documentation?+
Related reading
2026-06-04
ACID vs BASE: What Database Guarantees Actually Promise
ACID and BASE describe two ends of a tradeoff between strict correctness and scalable availability. Learn what each guarantee means, when each fits, and why most modern databases sit somewhere in between.
2026-06-04
Big-Endian vs Little-Endian
Byte order explained: how big-endian and little-endian lay out multi-byte numbers in memory, why network protocols pick one, and when the difference actually bites you.
2026-06-04
Big-O Notation in Plain English
Big-O describes how an algorithm's runtime or memory grows as input grows. Learn the common classes — O(1), O(log n), O(n), O(n log n), O(n^2), O(2^n) — with plain examples.
2026-06-04
CORS in Plain English: Why the Browser Blocks Your Fetch
A clear walkthrough of CORS and the same-origin policy — what an origin is, why your fetch fails, how servers opt in, and the big misconception about who CORS actually protects.
2026-06-04
Environment Variables and PATH, Explained
What environment variables actually are, why they hold config and secrets, and how PATH decides which binary runs when you type a command.
Get the best tools, weekly
One email every Friday. No spam, unsubscribe anytime.