Morse code is one of the few encoding systems that a human can transmit with nothing but a flashlight or a finger on a key — and that same human can decode it by ear. This guide covers how Morse code works, the full alphabet, and how to use a Morse code translator for bidirectional conversion.
Translate text to Morse code →
A Brief History of Morse Code
Samuel Morse and Alfred Vail developed Morse code in the 1830s alongside the electrical telegraph. The original system used different lengths of electrical current — dots (short) and dashes (long) — to represent letters and numbers.
The system was revolutionary: for the first time, messages could travel at the speed of electricity rather than a horse. The first long-distance telegraph message in the US was sent on May 24, 1844 from Washington D.C. to Baltimore: “What hath God wrought.”
Morse code was the dominant long-distance communication protocol for over a century. It was not formally retired from international maritime use until 1999.
How Morse Code Works
Morse code maps each letter and digit to a unique sequence of dots (·) and dashes (—):
- Dot (·): short signal, duration = 1 unit
- Dash (—): long signal, duration = 3 units
- Gap between symbols within a letter: 1 unit
- Gap between letters: 3 units
- Gap between words: 7 units
The timing ratios are the key: a dash is exactly 3× a dot, and word gaps are exactly 7× a dot. This fixed ratio lets experienced operators transmit and receive at speeds exceeding 25 words per minute.
The Morse Code Alphabet
Letters
| Letter | Code | Letter | Code | Letter | Code |
|---|---|---|---|---|---|
| A | ·— | J | ·——— | S | ··· |
| B | —··· | K | —·— | T | — |
| C | —·—· | L | ·—·· | U | ··— |
| D | —·· | M | —— | V | ···— |
| E | · | N | —· | W | ·—— |
| F | ··—· | O | ——— | X | —··— |
| G | ——· | P | ·——· | Y | —·—— |
| H | ···· | Q | ——·— | Z | ——·· |
| I | ·· | R | ·—· |
Digits
| Digit | Code | Digit | Code |
|---|---|---|---|
| 0 | ————— | 5 | ····· |
| 1 | ·———— | 6 | —···· |
| 2 | ··——— | 7 | ——··· |
| 3 | ···—— | 8 | ———·· |
| 4 | ····— | 9 | ————· |
Common Punctuation
| Character | Code |
|---|---|
| . (period) | ·—·—·— |
| , (comma) | ——··—— |
| ? (question) | ··——·· |
| / (slash) | —··—· |
| ( (open paren) | —·——· |
| ) (close paren) | —·——·— |
Prosigns and Special Sequences
Prosigns (procedure signs) are two-letter combinations transmitted without the inter-letter gap — they function as single units with special meanings. You will encounter them in historical radio logs and amateur radio QSOs:
| Prosign | Meaning |
|---|---|
| AR | End of message |
| AS | Wait / stand by |
| BT | Paragraph break (≡ or =) |
| CQ | Calling any station |
| DE | ”From” (identifies the sender) |
| K | Over (invitation to transmit) |
| KN | Go ahead, specific station only |
| SK | End of contact |
| SOS | Distress signal (···———···) |
SOS is the most famous: three dots, three dashes, three dots — chosen specifically because it is symmetrical and easy to recognize in any orientation.
Bidirectional Translation
A Morse code translator works in both directions:
Text to Morse: each character is looked up in a table and replaced with its dot-dash sequence. Words are separated by / or a 7-unit gap. This is unambiguous — every character has exactly one Morse representation.
Morse to text: the decoder splits on gaps or / characters and reverses the lookup. Ambiguity can arise with non-standard spacing or typos, but well-formed Morse has a unique decoding.
Encoding Logic (JavaScript)
const MORSE_MAP = {
'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': '----.'
};
function textToMorse(text) {
return text.toUpperCase().split('').map(char => {
if (char === ' ') return '/';
return MORSE_MAP[char] ?? '?';
}).join(' ');
}
// 'SOS' → '... --- ...'
// 'HELLO WORLD' → '.... . .-.. .-.. --- / .-- --- .-. .-.. -..'
Decoding Logic (JavaScript)
const REVERSE_MAP = Object.fromEntries(
Object.entries(MORSE_MAP).map(([k, v]) => [v, k])
);
function morseToText(morse) {
return morse.split(' / ').map(word => {
return word.split(' ').map(code => {
if (code === '') return '';
return REVERSE_MAP[code] ?? '?';
}).join('');
}).join(' ');
}
// '... --- ...' → 'SOS'
Python Implementation
MORSE_MAP = {
'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_MAP = {v: k for k, v in MORSE_MAP.items()}
def text_to_morse(text: str) -> str:
return ' '.join(
'/' if c == ' ' else MORSE_MAP.get(c.upper(), '?')
for c in text
)
def morse_to_text(morse: str) -> str:
words = morse.strip().split(' / ')
return ' '.join(
''.join(REVERSE_MAP.get(code, '?') for code in word.split())
for word in words
)
print(text_to_morse('SOS')) # ... --- ...
print(morse_to_text('... --- ...')) # SOS
Practical Applications
Amateur radio (ham radio): Morse code (CW mode) is still actively used by licensed amateur radio operators. It requires less bandwidth than voice and can punch through interference that would make voice unintelligible. Many operators find it meditative.
Accessibility: Morse code is used as an alternative input method. iOS and Android both support Morse input for users who cannot operate standard touch keyboards — a single switch can input any character.
Steganography: Morse code embedded in audio waveforms or image metadata is a common CTF (Capture the Flag) challenge technique.
Learning and games: Morse code is a popular learning project for embedded systems — blinking an LED or buzzing a piezo speaker to output Morse is a classic “Hello, World” for hardware hackers.
Translate Morse Code Online
ZeroTool’s Morse Code Translator converts text to Morse code and Morse code back to text in real time. Supports the full ITU Morse alphabet, digits, and common punctuation. No signup, runs entirely in the browser.