Skip to content
MorseBeep
πŸ‡¬πŸ‡§ EN

How it works

Is Morse Code Binary? What a Computer Scientist Sees in It

By Kashif Sulehria. . 3 min read.

Morse code is not really binary. It looks like it, with only dots and dashes, but it cannot work without the silences between them, and those silences come in three lengths. Counting the dot, the dash and the three gaps, Morse is a code of five symbols. On the wire, though, it is sent as a signal that is simply on or off, which is binary, with the meaning carried by timing.

Both answers are right, depending on where you look.

Why dots and dashes are not enough

Try writing a message with dots and dashes and no spaces. HI is .... .. and that run of six dots, written without the gap, could just as well be S and S, or I, I and I, or E six times. Without the gap between letters you cannot tell where one letter ends and the next begins.

The trouble is that Morse codes are prefixes of each other. E is a single dot, ., and every other letter that starts with a dot begins with an E: A .-, I .., S ..., H ..... So the code needs something extra to mark the end of each letter, and that something is the gap.

The five symbols

Morse timing is built from one unit of time:

Symbol Length
Dot 1 unit of sound
Dash 3 units of sound
Gap inside a letter 1 unit of silence
Gap between letters 3 units of silence
Gap between words 7 units of silence

Strictly, then, Morse is a variable-length code over five symbols, two of sound and three of silence. The rules come from the International Telecommunication Union's standard, and how Morse code works covers them in detail.

But on the wire, it is binary

Look at a Morse signal on an oscilloscope and you see only two states: tone or no tone, current or no current. If you sample it once per unit, Morse turns into a string of 1s and 0s. A dot is 1, a dash is 111, and the gaps are 0, 000 and 0000000.

SOS, written that way, is:

10101 000 11101110111 000 10101

Twenty-seven units, of which fifteen are sound. In that sense Morse is one of the earliest binary transmission schemes, about a century before the word "bit" was coined. What makes it more than binary is that the meaning lives in the lengths of the runs, not in single bits.

Short codes for common letters

The cleverest part of Morse is not the dots and dashes; it is which letters got which codes. Alfred Vail, who worked with Samuel Morse, estimated how often each letter is used in English by counting the type in a newspaper's type cases in Morristown, New Jersey. The commonest letters got the shortest codes:

  • E, the commonest letter in English, is .
  • T is -
  • A, I, N and M take two signs each
  • Rare letters such as Q, --.-, Y, -.--, and J, .---, take four

The result is that ordinary English text takes much less time to send than it would if every letter were the same length.

Morse and Huffman coding

That idea, giving frequent symbols short codes, is the heart of modern data compression. In 1952 David Huffman, then a student at MIT, published a method for building the best possible code of this kind for any set of symbol frequencies. Huffman codes are still used inside the formats that compress files, images and audio today.

There is one important difference. A Huffman code is a prefix code: no code is the beginning of another, so it can be decoded with no gaps at all. Morse is not, which is exactly why it needs its gaps. Vail had the right instinct about frequency, a century early, but not the trick that removes the need for separators.

Hear the difference

Play E and T, . -, and then Q and Y, --.- -.--, and you can hear Vail's design at work: the common letters are over almost before they start. You can explore the rest of the alphabet in the chart, where every letter plays when you tap it, or read who actually designed the alphabet.

Sources

Spotted a mistake? Tell us and it will be corrected. Every dot-and-dash example on this page plays when you tap it, using your speed and tone from the translator.

All 20 articles