Hello World is a simple program that displays the message “Hello, World!” on a screen. It’s usually the first program people write when learning a new programming language, because it shows the language’s most basic syntax and proves the setup works. In Python, the whole program is a single line: print(“Hello, World!”).
The tradition started at Bell Labs in the early 1970s and has outlived almost every machine it was first written for. Below, we explain what the phrase means, what a Hello World program actually tests, how to write and run your first one, where it came from, and what it looks like in 25 programming languages.
Literally, it’s a new program greeting the world. The message has no technical meaning. It’s a convention, and a deliberately friendly one: the first output of a new program is its first sign of life, so a greeting fits.
The exact wording has drifted over the years. The original examples from Bell Labs used lowercase “hello, world” with no exclamation mark. Most tutorials now print “Hello, World!”, and plenty drop the comma. None of these differences matter to the computer, because the program just prints whatever text it’s given.
Developers also use “hello world” as shorthand for the simplest working version of anything. A “hello world app” is a bare-bones app that runs but does almost nothing, and a “hello world” for a new API or tool is the smallest request that returns a result. In both cases, the point is the same: confirm that the basics work before building anything real.
Printing one line of text looks trivial, but a Hello World program quietly checks every link in the chain between writing code and seeing it run. If the message appears, each of these steps worked:
This is why experienced developers still write Hello World on a new machine or with a new tool. When something breaks later in a bigger project, you already know the foundation is sound, and the error message tells you which link failed.
Python is the easiest place to start because the program is a single line and there’s nothing to compile. These steps work on Windows, macOS, and Linux:
Compiled languages add one step. In C, for example, you save the code as hello.c, compile it with a command such as gcc hello.c -o hello, and then run the resulting program with ./hello. If you’d rather not install anything, open your web browser’s developer console (F12 in most browsers), type console.log(“Hello, World!”) and press Enter. That’s a working JavaScript Hello World.
Hello World has a handful of practical jobs beyond being a beginner’s first program.
It’s the standard first lesson in almost every programming language tutorial and textbook. In a few lines, it shows how a language structures a program, where code starts running, how it handles text, and how it produces output. Experienced programmers use it the same way when picking up a second or third language: it’s a quick way to see how much ceremony a language needs before it does anything.
A sanity test is a quick check that something basic works before you rely on it. Running Hello World after setting up a new computer, installing a compiler, or configuring a code editor confirms that the tools are installed, connected, and able to build and run code. If Hello World fails, there’s no point testing anything more complex yet.
Before committing to a new platform, framework, or device, developers often build a Hello World version first. It proves that code can be written, deployed, and run in that environment at all, which surfaces configuration and compatibility problems early, when they’re still cheap to fix.
When code changes don’t seem to take effect, a simple printed message is a fast way to check what’s going on. Adding a Hello World style line confirms that the program is actually being rebuilt and reloaded, and that execution reaches the part of the code you expect. It’s one of the most basic debugging techniques, and still one of the most used.
Because every language can produce the same output, Hello World makes a fair, if rough, basis for comparison. Developers use it to compare how much code each language needs, how large the compiled program is, and how much supporting software is required to run it. A Hello World written in C or machine language can be tiny, while the same output from a language that runs on a large runtime or virtual machine pulls in far more behind the scenes.
Small test programs existed long before “Hello, World!”, but the phrase itself traces back to Brian Kernighan at Bell Labs.
The earliest known version appears in Kernighan’s internal guide, A Tutorial Introduction to the Language B, written around 1972. B was the predecessor of C and could only store a few characters in each variable, so the example splits the message into pieces: one variable holds “hell”, another “o, w,” and a third “orld”, and the program prints them in sequence. Kernighan then reused the greeting in his 1974 memo, Programming in C: A Tutorial, where a single printf(“hello, world”); line did the job.
The example reached a mass audience in 1978, when Kernighan and Dennis Ritchie published The C Programming Language. Hello World is the book’s first program, and the book became the standard way programmers learned C. As C and the Unix operating system spread from Bell Labs to universities and companies, much of it running on Digital Equipment Corporation’s PDP-11 minicomputer, the habit of starting with Hello World spread with them.

As for why he chose those words, Kernighan has said his memory is dim. In an interview with Forbes India, he recalled seeing a cartoon of a chick hatching from an egg and saying “Hello, World”, which may have planted the idea.
Later language designers adopted the convention almost without exception. Today practically every language’s official tutorial opens with it, and enthusiasts maintain collections of Hello World programs covering hundreds of languages, from mainstream ones like Python to deliberately obscure joke languages.
Time to Hello World is the time it takes a newcomer to go from nothing to a working Hello World program in a given language or tool. It’s an informal measure of how approachable something is. A short TTHW means less setup, less boilerplate, and fewer chances to get stuck before seeing a result.
The idea is easiest to see in the code itself. Python needs one line. A traditional Java Hello World needs a class, a main method with a specific signature and a print statement, so a beginner meets several concepts at once before anything appears on screen. Language designers have noticed: C# added top-level statements in 2020 so a program can be a single line, and recent Java releases have reduced the boilerplate needed for simple programs.
The concept has also spread well beyond programming languages. Companies that sell APIs, software development kits (SDKs) and developer platforms track TTHW as a developer experience metric, measuring how quickly a new user can sign up, authenticate and make a first successful request. A long TTHW is a common reason developers abandon a tool before they’ve seen what it can do.
The Hello World idea now applies to almost any technology where you need to prove the basics work.
The examples below show Hello World in 25 languages, starting with the most widely used today. Notice how the amount of code changes. Scripting languages like Python, Ruby, and Bash usually need a single statement, because they run code from top to bottom with no setup. Languages built for larger applications or tighter control over the machine, such as Java, C, and assembly, require more structure to achieve the same output. As a rule, the closer a language sits to the hardware, the more code Hello World takes.
The shortest mainstream Hello World and the reason Python is a common first language.
print(“Hello, World!”)
Runs in any web browser’s console or in Node.js.
console.log(“Hello, World!”);
The classic form, with the class and main method every Java program traditionally needs.
public class HelloWorld {
public static void main(String[] args) {
System.out.println(“Hello, World!”);
}
}
A modern version of the program from Kernighan and Ritchie’s book.
#include <stdio.h>
int main(void) {
printf(“Hello, World!n”);
return 0;
}
Uses the iostream library instead of C’s printf.
#include <iostream>
int main() {
std::cout << “Hello, World!” << std::endl;
return 0;
}
The traditional form is below. Since C# 9, the single-line Console.WriteLine(“Hello, World!”); also works on its own.
using System;
class Program {
static void Main() {
Console.WriteLine(“Hello, World!”);
}
}
Every Go program starts with a package declaration and imports what it uses.
package main
import “fmt”
func main() {
fmt.Println(“Hello, World!”)
}
The exclamation mark in println! marks it as a macro rather than a function.
fn main() {
println!(“Hello, World!”);
}
Runs on the Java Virtual Machine but needs far less boilerplate than Java.
fun main() {
println(“Hello, World!”)
}
Apple’s language matches Python’s one-line approach.
print(“Hello, World!”)
Usually embedded in web pages, so code sits inside PHP tags.
<?php
echo “Hello, World!”;
puts prints the text and adds a new line.
puts “Hello, World!”
The n adds the line break that print leaves out.
print “Hello, World!n”;
The shell scripting language built into Linux and macOS terminals.
echo “Hello, World!”
Standard SQL can simply select the text. Oracle’s PL/SQL uses a built-in output package.
SELECT ‘Hello, World!’;
BEGIN
DBMS_OUTPUT.PUT_LINE(‘Hello, World!’);
END;
/
The Visual Basic .NET console version.
Module HelloWorld
Sub Main()
Console.WriteLine(“Hello, World!”)
End Sub
End Module
A classic Scala program wraps main in a singleton object.
object HelloWorld {
def main(args: Array[String]): Unit = {
println(“Hello, World!”)
}
}
A functional language in which the whole program is a single definition.
main = putStrLn “Hello, World!”
The ~% directive adds a new line.
(format t “Hello, World!~%”)
A language designed for safety-critical systems, with verbose, explicit structure.
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line (“Hello, World!”);
end Hello;
A long-time teaching language with a clear begin and end structure.
program HelloWorld;
begin
writeln(‘Hello, World!’);
end.
One of the oldest programming languages still in use, mainly for scientific computing.
program hello
print *, ‘Hello, World!’
end program hello
COBOL organizes every program into named divisions, a legacy of its business computing roots.
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
DISPLAY ‘Hello, World!’.
STOP RUN.
Microsoft’s original server-side scripting for web pages.
<% Response.Write(“Hello, World!”) %>
Without a language doing the work, the program has to ask the operating system directly to write the text and then exit.
section .data
msg db “Hello, World!”, 10
len equ $ – msg
section .text
global _start
_start:
mov rax, 1 ; system call: write
mov rdi, 1 ; file descriptor 1: standard output
mov rsi, msg ; address of the message
mov rdx, len ; length of the message
syscall
mov rax, 60 ; system call: exit
xor rdi, rdi ; exit code 0
syscall