Glossary

What is a Hello World program?

A Hello World program is the smallest working program in a programming language. It prints the words “Hello, world” on screen, and programmers write one first to learn the basics and prove their tools work.

By Bryan HurleyLast reviewed 26 October 20264 min read

Direct answer

A Hello World program is the smallest working program you can write in a programming language. It does one thing: it displays the words “Hello, world”. Programmers write one first when they learn a new language, and they run one to prove that a new computer, editor or server is set up correctly.

If the program prints the greeting, everything between the code and the screen works: the language is installed, the code was read correctly and the output reached you. If it fails, the problem is in the setup, not in your code, because there is almost no code to get wrong.

What a Hello World program does

A Hello World program has three jobs, and none of them is the greeting itself.

  • It shows the minimum shape of a language. You see how a program starts, how text is written and how output is produced.
  • It tests the tools. A running Hello World proves the compiler or interpreter, the editor and the terminal all work together.
  • It gives a first success. A new programmer sees their own words appear within minutes, which is a good reason to keep going.

Experienced developers use it too. When they set up a new server, framework or deployment, a Hello World page is often the first thing they publish. It is a quick “smoke test”: if the greeting appears, everything is connected end to end.

Hello World in six languages

The program looks different in every language, and that difference is the lesson. Some languages need one line; others need a class, a main function and a library.

Python

print("Hello, world")

JavaScript

console.log("Hello, world");

C

#include <stdio.h>

int main(void) {
    printf("Hello, world\n");
    return 0;
}

Java

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, world");
    }
}

HTML

<!DOCTYPE html>
<html lang="en">
  <head><meta charset="utf-8"><title>Hello</title></head>
  <body><p>Hello, world</p></body>
</html>

Shell (macOS and Linux terminal)

echo "Hello, world"

Where Hello World came from

The earliest known written example is in A Tutorial Introduction to the Language B, which Brian Kernighan wrote at Bell Labs in 1972. B could only hold four characters in one text constant, so the example built the phrase from three pieces: “hell”, “o, w” and “orld”.

Kernighan used the phrase again in a 1974 Bell Labs memo, Programming in C: A Tutorial. In 1978 it appeared as the first example in The C Programming Language by Kernighan and Dennis Ritchie. That book taught C to a generation of programmers, and its first program became the first program in many of the courses and books that followed.

The original printed “hello, world” in lower case, with a comma and no exclamation mark. “Hello, World!” with capitals came later and is now just as common.

Why those words? Kernighan has said, with the warning that his memory of it is hazy, that he remembers a cartoon of a chick hatching from an egg and saying “hello, world”. An older claim, that the phrase started in the BCPL language in 1967, has never been confirmed. The Wikipedia article on the Hello World program (opens in a new tab) lists the sources for both.

Hello World beyond a text greeting

The idea has spread to anything that needs a smallest possible first test.

  • Electronics: on a microcontroller board with no screen, the first program usually blinks a light.
  • Graphics: the first program in a 3D graphics course draws a single coloured triangle, often called “Hello Triangle”.
  • New projects: some tools create a Hello World for you. Rust’s Cargo tool, for example, starts every new project with one.
  • Software products: “time to Hello World” measures how long a newcomer takes to get a first example running. Teams use it to judge how easy a language, framework or API is to start with.

Saying hello to the world

“Hello, world” is a small statement of intent. A new program’s first act is not to greet one person. It greets everyone. That is what software and the web made possible: something written once, in one place, can be read anywhere on earth. Tim Berners-Lee, who invented the web, put it in four words at the London 2012 Olympics: “This is for everyone”.

Every business has its own Hello World moment: the first time a stranger anywhere can find it, understand it and choose it. For years that moment was a website and a search result. Now it often happens inside an AI assistant. When a buyer asks ChatGPT or Google’s AI answers about your market, the reply is your greeting to the world, whether you wrote it or not.

That is the idea behind the name. HelloWorld is an Answer Engine Optimisation studio in Ireland, and our work is making sure that greeting says the right thing about you. Read what generative engine optimisation means or see how the AI Visibility Audit works.

Frequently asked questions

Is it a Hello World program or a Hello World programme?

Program. In British and Irish English, software is spelled “program”, the same as in American English. “Programme” is for a schedule, a broadcast or a planned course of work.

Why is the first program always Hello World?

Because the 1978 book The C Programming Language started with it, and most later books and courses copied that first step. The phrase is short, friendly and easy to spot in the output, so it stuck.

Does a Hello World program need the comma and the exclamation mark?

No. The original printed “hello, world” with no capitals and no exclamation mark. Any version that prints the greeting does the job.

Who wrote the first Hello World program?

The earliest known written example is by Brian Kernighan, in a 1972 Bell Labs tutorial for the B language. He and Dennis Ritchie made it famous in their 1978 book on C.

What is “time to Hello World”?

It is how long a newcomer takes to go from nothing to a running Hello World example. A short time means a language, framework or API is easy to start with.

Next step

Find out where you stand in AI answers

The AI Visibility Audit tests your buyers’ real questions across five AI assistants, shows who gets cited instead of you, and ends with a phased 90-day plan.