Hello World in Morse Code

The programmer's first program, rendered in the first electrical code.

HELLO WORLD in Morse code

.... . .-.. .-.. --- / .-- --- .-. .-.. -..

HELLO WORLD

Advertisement

Character by character

HELLO WORLD
Character Morse code Play Copy
H ....
E .
L .-..
L .-..
O ---
Word gap /
W .--
O ---
R .-.
L .-..
D -..

Why this phrase and not another

"Hello, world" became the standard first program after it appeared in Brian Kernighan's 1972 tutorial for the language B, and again in The C Programming Language in 1978. Since then, printing it has been how programmers check that a new language, compiler or device is working at all.

That is exactly why it keeps turning up in Morse. It is the phrase people reach for when they build a Morse encoder as a learning exercise, wire up a buzzer to a microcontroller, or test that an LED can blink accurately enough to be read. If the buzzer produces .... . .-.. .-.. --- / .-- --- .-. .-.. -.. at the right speed, the whole chain works.

There is a pleasing symmetry to it: the greeting that verifies a new machine, written in the code that opened the first electrical communication network.

What it looks like on hardware

Sending this from a microcontroller is a common first project, and the part that catches people out is never the letters — it is the gaps. The 1-3-3-7 rule means five different delays: one unit for a dot, three for a dash, one between the parts of a letter, three between letters and seven between the two words.

Get the letter gaps wrong and the message still blinks convincingly but decodes to nonsense. Run WORLD together without the three-unit separations and a reader gets a completely different sequence of characters.

The full timing table, with every gap converted to milliseconds for any speed, is on the Morse code timing page. Twenty words per minute is a good target: fast enough to sound real, slow enough to check by ear against the audio here.

Frequently Asked Questions

What is hello world in Morse code?

It is .... . .-.. .-.. --- / .-- --- .-. .-.. -... The slash marks the gap between the two words.

How many signals is that?

Twenty-six dots and dashes in total: twelve for HELLO and fourteen for WORLD, plus the gaps between letters and between the two words.

How long does hello world take to send?

About six seconds at 20 words per minute, or twelve at 10. The exact figure depends on the speed, since every length in Morse is a multiple of one time unit.

Advertisement