Skip to content
ASCII World

Morse Code and ASCII

Two Encoding Systems Separated by 126 Years

By the ASCII World team

1. How Morse Code Works

Morse code represents each character as a sequence of short signals (dots, written as .) and long signals (dashes, written as -). A dash lasts three times as long as a dot. Silence separates elements: one dot-length between dots and dashes within a character, three dot-lengths between characters, and seven dot-lengths between words.

Unlike ASCII, which uses a fixed 7 bits per character, Morse uses variable-length encoding. The letter E is a single dot (.). The letter Q is four elements (--.-). This variable width is deliberate. Samuel Morse studied letter frequency in English by counting movable type in a Philadelphia newspaper's composing room. He assigned the shortest codes to the letters that appeared most often.

E (12.7% frequency in English) gets one dot. T (9.1%) gets one dash. A (8.2%) gets dot-dash. Contrast this with ASCII, where A is code 65 and Z is code 90 in straight alphabetical order, regardless of how often each letter appears in practice.

2. Complete Morse-to-ASCII Mapping

International Morse Code (ITU-R M.1677) defines codes for the 26 Latin letters, 10 digits, and common punctuation marks. Each maps to a specific ASCII code point.

CharASCII DecMorseCharASCII DecMorse
A65.-N78-.
B66-...O79---
C67-.-.P80.--.
D68-..Q81--.-
E69.R82.-.
F70..-.S83...
G71--.T84-
H72....U85..-
I73..V86...-
J74.---W87.--
K75-.-X88-..-
L76.-..Y89-.--
M77--Z90--..
DigitASCII DecMorseDigitASCII DecMorse
048-----553.....
149.----654-....
250..---755--...
351...--856---..
452....-957----.
SymbolASCII DecMorse
Period (.)46.-.-.-
Comma (,)44--..--
Question (?)63..--..
Apostrophe (')39.----.
Slash (/)47-..-.
At sign (@)64.--.-.
Equals (=)61-...-

Notice that digits use exactly 5 elements each (a mix of dots and dashes), while letters range from 1 to 4 elements. Look up individual ASCII codes on the ASCII table or use the text to ASCII converter to see the decimal values for any character.

3. International vs American Morse

Samuel Morse's original 1837 code (American Morse) used dots, dashes, and internal spaces within some characters. The letter C was .. . (two dots, a space, then a dot). This made it ambiguous at high speeds because operators had to distinguish between an intra-character space and an inter-character space by timing alone.

Friedrich Clemens Gerke redesigned the system in 1848 for use on European telegraph lines. His revision eliminated internal spaces, using only dots and dashes of standardized lengths. The ITU adopted Gerke's version as International Morse Code in 1865. American Morse survived on US railroad telegraph circuits until the 1960s but is now extinct in active use.

All modern Morse usage (amateur radio, aviation, naval signaling) uses International Morse. When this article says "Morse code," it means the ITU international standard.

4. Design Philosophy Comparison

Morse and ASCII made opposite tradeoffs because they solved different physical problems.

Design AspectMorse Code (1837)ASCII (1963)
Code widthVariable (1-6 elements)Fixed (7 bits)
Optimized forTransmission speedDigital storage and sorting
Frequency encodingYes (shorter codes for common letters)No (alphabetical order)
Case sensitiveNoYes (A=65, a=97)
Character count~50 (letters, digits, punctuation)128 (including 33 control characters)
Timing-dependentYes (dot/dash/gap lengths)No (discrete bit values)
Error detectionNone built inParity bit (optional 8th bit)
Machine-readableRequires trained operator or audio decoderDirect binary representation

Morse's variable-width approach is a form of entropy coding, similar in principle to Huffman coding (1952). Frequent symbols get short codes, rare symbols get long codes, minimizing average transmission time. ASCII abandoned this optimization because digital hardware processes fixed-width values faster than variable-width ones. When every character is exactly 7 bits, extracting character N from a string is a single offset calculation, not a sequential scan.

See the encoding timeline for how these systems fit into the broader history of character representation.

5. Morse in Modern Use

Amateur radio operators ("hams") still use Morse code for long-distance communication, particularly in the HF bands (3-30 MHz). CW (continuous wave) Morse transmissions cut through noise and interference better than voice because the bandwidth is narrow (about 100 Hz vs 2400 Hz for SSB voice). A 5-watt CW signal can reach across oceans when a 100-watt voice signal cannot.

Aviation uses Morse for VOR (VHF Omnidirectional Range) navigation beacons. Each VOR station broadcasts its three-letter identifier in Morse code so pilots can verify they are tuned to the correct beacon. The identifier "LAX" for Los Angeles transmits as .-.. .- -..-.

SOS (... --- ...) remains the international distress signal, recognized by maritime law. The Titanic's radio operators transmitted SOS in 1912 using Morse code, one of the earliest high-profile uses of the distress signal. Modern ships carry automatic Morse transmitters that activate when the vessel is in danger.

6. Converting Between Morse and ASCII

Conversion is a straightforward lookup table operation. Map each ASCII character to its Morse sequence for encoding, and each Morse sequence back to ASCII for decoding. Here is a Python implementation:

MORSE_TABLE = {
    'A': '.-',    'B': '-...',  'C': '-.-.',  'D': '-..',
    'E': '.',     'F': '..-.',  'G': '--.',   'H': '....',
    'I': '..',    'J': '.---',  'K': '-.-',   'L': '.-..',
    'M': '--',    'N': '-.',    'O': '---',   'P': '.--.',
    'Q': '--.-',  'R': '.-.',   'S': '...',   'T': '-',
    'U': '..-',   'V': '...-',  'W': '.--',   'X': '-..-',
    'Y': '-.--',  'Z': '--..',
    '0': '-----', '1': '.----', '2': '..---', '3': '...--',
    '4': '....-', '5': '.....', '6': '-....', '7': '--...',
    '8': '---..', '9': '----.',
    ' ': '/',
}

REVERSE_TABLE = {v: k for k, v in MORSE_TABLE.items()}

def text_to_morse(text):
    return ' '.join(MORSE_TABLE.get(c, '?') for c in text.upper())

def morse_to_text(morse):
    return ''.join(REVERSE_TABLE.get(code, '?') for code in morse.split())

print(text_to_morse('HELLO WORLD'))
# .... . .-.. .-.. --- / .-- --- .-. .-.. -..

print(morse_to_text('.... . .-.. .-.. ---'))
# HELLO

Note that Morse code is case-insensitive. Converting from ASCII to Morse discards the case distinction between A (65) and a (97). Converting back from Morse always produces uppercase. Use the text to ASCII tool to verify the decimal codes, and the binary to ASCII converter to see how ASCII represents these characters at the bit level.

7. What Morse Cannot Encode

Standard International Morse defines codes for 26 letters, 10 digits, and roughly 15 punctuation marks. It has no codes for lowercase letters (case is not distinguished), control characters, or most of the 95 printable ASCII characters beyond basic punctuation. There is no Morse code for {, }, |, ~, or the backtick.

Extensions exist for accented characters used in specific languages (German, French, Spanish), but these are not universally standardized. Japanese Morse code (Wabun code) is a separate system entirely, using the same dot-dash mechanism but with a different mapping table for katakana characters.

ASCII's 128 positions cover everything Morse can encode, plus 80+ additional characters that have no Morse equivalent. Unicode extends this further to 154,000+ characters across 168 scripts, far beyond what any telegraph system could practically handle. For the full scope of what ASCII covers, browse the ASCII chart view or the keyboard reference to see which characters are directly accessible from a standard keyboard.

References

  1. ITU Recommendation M.1677 - International Morse Code
  2. ARRL - Morse Code: The Essential Language (Amateur Radio)
  3. RFC 20 - ASCII format for Network Interchange
  4. Smithsonian - Samuel Morse's Telegraph