On-Off Keying · Est. 1844 · Still Transmitting

Morse / Code

Two states — key up, key down — and the space between them. From a wire strung between Washington and Baltimore to a radio operator's ear across an ocean of static, this is how humanity first sent thought at the speed of electricity. Everything below is interactive: read it, hear it, key it, and run it in GNU Octave.

—·· ·· ··· ···—···PHOSPHOR TRACE · 18 WPM · 650 Hz
01 — Origin

A rhythm that crossed oceans

In 1844 Samuel Morse tapped out ·—— ···· ·— ···— — "What hath God wrought" — over 40 miles of wire. The device didn't transmit letters. It transmitted time: how long the circuit stayed closed, and how long it stayed open.

The genius wasn't the alphabet. It was recognizing that a single binary event — current or no current — becomes a language once you agree on the durations and the silences between them. Alfred Vail is credited with shaping the code itself, reportedly counting the movable type in a printer's tray to give the commonest English letters the shortest signals. E is one dit; Q is four elements. That frequency-weighting is a Huffman code built by hand, a full century before David Huffman formalized the idea in 1952.

American vs. International. The original "American Morse" used internal spaces and varied dash lengths and was clumsy over radio. The International Morse Code standardized in 1865 — clean dits and dahs with a fixed 1:3 ratio — is what the world settled on and what this guide teaches throughout.
The four durations that are the entire code
ElementSymbolLengthMeaning
Dit·1 unit ONthe short mark
Dah3 units ONthe long mark
Element gap 1 unit OFFwithin a letter
Letter gap/3 units OFFbetween letters
Word gap//7 units OFFbetween words

Every signal on this page is built from exactly these five durations. Change the "unit" and you change the speed — nothing else. That single parameter is the subject of the Timing & Math section.

02 — The Alphabet

The full International Morse chart

Every glyph below is clickable — tap it to hear the actual keyed signal at the current lab settings. Dits render amber, dahs render teal, so you can read the rhythm by color.

tap any glyph to key it tone 650 Hz 18 WPM

Letters

Digits

Punctuation

Prosigns

Procedural signals sent as one fused character — no letter gap between the parts. The overbar shows the fusion.

ProsignCodeMeans

The operator's shorthand

A century of radio built a dense vernacular so common phrases fit in a few characters. A sampler:

SignalMeaning
CQCalling any station
DE"from" (this is ...)
KOver / go ahead
RReceived, understood
73Best regards
88Love and kisses
QTHMy location is ...
QRZWho is calling me?
QRM / QRNInterference / static
SKEnd of contact (silent key)
Why SOS? It isn't an abbreviation for anything — not "Save Our Souls." It was chosen in 1906 precisely because ···———··· keyed as one unbroken nine-element string is impossible to mistake for anything else, even through heavy static and fading. Rhythm was the whole point.
03 — Timing & Math

Speed is one number

Because every duration is a multiple of the single "unit," a Morse transmission has exactly one free parameter: the length of one dit. Fix that, and dahs, gaps, and word spaces all follow. The standard way to name that parameter is words per minute.

The PARIS standard

"WPM" needs a reference word, because words differ in length. The convention is the word PARIS followed by one word space — chosen because it measures out to exactly 50 units. Counting every dit, dah, and gap:

\[ \underbrace{11}_{\text{P}}+\underbrace{5}_{\text{A}}+\underbrace{7}_{\text{R}}+\underbrace{3}_{\text{I}}+\underbrace{5}_{\text{S}} \;+\; \underbrace{4\times 3}_{\text{letter gaps}} \;+\; \underbrace{7}_{\text{word gap}} \;=\; 50 \ \text{units} \] char durations (31) + inter-letter gaps (12) + word gap (7) = 50

If you send W words per minute, you emit \(50W\) units per minute. One unit (one dit) therefore lasts:

\[ T_{\text{dit}} \;=\; \frac{60}{50\,W}\ \text{s} \;=\; \frac{1.2}{W}\ \text{s} \;=\; \frac{1200}{W}\ \text{ms} \] at 20 WPM a dit is 60 ms; at 5 WPM it is 240 ms

Everything else is a fixed multiple of \(T_{\text{dit}}\):

\[ T_{\text{dah}}=3T_{\text{dit}},\quad g_{\text{elem}}=1T,\quad g_{\text{letter}}=3T,\quad g_{\text{word}}=7T \]
Live timing diagram
WPM 18
1 dit = 66.7 mstotal
Farnsworth calculator

Learners can hear fast characters but need thinking time between them. Farnsworth timing keeps each character at a brisk speed \(c\) but stretches the gaps so the overall rate is a slower \(s\).

char speed c 18
overall speed s 9

The Farnsworth formula

Of PARIS's 50 units, 31 belong to the characters themselves and 19 are spacing (12 letter-gaps + 7 word-gap). Send the 31 character-units at speed \(c\), then pad the 19 spacing units until the whole word fits the budget for speed \(s\):

\[ t_c=\frac{1.2}{c}\ \text{s},\qquad t_{\text{word}}=\frac{60}{s}\ \text{s} \] \[ u_{\text{gap}}=\frac{\,t_{\text{word}}-31\,t_c\,}{19}=\frac{1}{19}\!\left(\frac{60}{s}-\frac{37.2}{c}\right)\ \text{s} \] u_gap is the stretched spacing-unit; it equals t_c exactly when s = c

This is why a 5-WPM code-practice recording can still contain crisp, full-speed 18-WPM letters — only the silence is dilated.

04 — Translator

Text in, dits out — both ways

Type in either field; the other updates live. The Morse field accepts dots/dashes or the Unicode · —; letters are separated by spaces and words by /.

Plain textlive
Morse· — /
05 — Audio Lab

Hear the keying — clicks and all

Real CW is a sine carrier switched on and off. How you switch it matters: a hard on/off edge splatters energy across the band as "key clicks." Toggle envelope shaping below and listen to the difference — then see why in Signal & Bandwidth.

Transmitter key
WPM 18 tone 650 Hz
volume 0.5 Farnsworth 18

Farnsworth ≤ WPM stretches the gaps only. Pure Web Audio API — no files.

Live oscilloscope
·· ··

The trace is the actual gain envelope sent to the oscillator. With soft keying the rising and falling edges are smooth curves; turn it off and they become vertical cliffs.

06 — Key & Trainer

Send it yourself. Then learn to copy.

The left pad is a straight key: press and hold. A short hold is a dit, a long hold a dah; a pause ends a letter, a longer pause ends a word. The right panel is a Koch-method listening trainer — the way operators are actually taught.

Straight key thresh @ 18 WPM
·HOLD = KEY DOWN
short → dit  ·  long → dah  ·  spacebar works too
buffer decoded  
key speed 18 WPM

Tip: try SOS — three quick taps, three long holds, three quick taps, then wait.

Koch trainer listen & type

Ludwig Koch's method: learn at full speed from just two characters, adding one only when you hit 90%. Characters play fast; the spacing is Farnsworth-slowed so your ear learns rhythm, not counting.

 
score 0 / 0 accuracy
07 — Signal & Bandwidth

Why keying shape is spectrum

A CW transmission is a carrier multiplied by a keying envelope. That multiplication in time is a convolution in frequency — so the shape of your on/off edges literally determines how much spectrum you occupy and how far your clicks travel into the neighbors' conversations.

The keyed carrier

\[ s(t) \;=\; A\,\underbrace{g(t)}_{\text{envelope}\,\in[0,1]}\,\cos(2\pi f_0 t) \] g(t) is the key: 1 while down, 0 while up, with shaped transitions

Hard keying makes \(g(t)\) a rectangular pulse. A rectangle's spectrum is a \(\operatorname{sinc}\), whose sidelobes fall off slowly (like \(1/f\)) — those are the key clicks. A raised-cosine rise/fall over time \(t_r\) tames them:

\[ g_{\uparrow}(t)=\tfrac12\!\left[1-\cos\!\Big(\tfrac{\pi t}{t_r}\Big)\right],\quad 0\le t\le t_r \] smooth start and stop → sidelobes fall off far faster (≈ 1/f³)

Occupied bandwidth

A string of dits at \(W\) WPM has a fundamental keying frequency (one dit + one gap = 2 units):

\[ f_k=\frac{1}{2\,T_{\text{dit}}}=\frac{W}{2.4}\ \text{Hz} \]

A common engineering estimate for the necessary bandwidth of shaped CW uses a keying factor \(K\) (≈3 for soft edges, ≈5 for hard):

\[ B \;\approx\; K\cdot f_k \;=\; \frac{K\,W}{2.4}\ \text{Hz} \] 30 WPM, K=3 → ≈ 37 Hz; hard keying (K=5) nearly doubles it
Envelope & spectrum
edge time tr 5.0 ms

Drag tr to 0 for a rectangular key: watch the sidelobes fill the band. Increase it and the skirts collapse — quieter clicks, narrower footprint, but mushier-sounding edges if overdone.

08 — Information

A handmade Huffman code

Vail's frequency weighting was an intuition that Shannon later made exact: to minimize average transmission time, assign the shortest signals to the most frequent symbols. Below, each letter's Morse cost in units is plotted against how often it appears in English. The bars slope the right way — common letters are cheap.

Cost vs. frequency — English letters
unit-cost of the letter English frequency

Weighted average length

Let \(p_i\) be a letter's frequency and \(\ell_i\) its cost in time-units (dits=1, dahs=3, plus internal gaps). The expected units per letter is:

\[ \bar{\ell}=\sum_i p_i\,\ell_i \;\approx\; \mathbf{__LBAR__}\ \text{units/letter} \] a uniform assignment of the same code lengths would cost more

Compare with the Shannon entropy of English letters, the theoretical floor on bits per symbol:

\[ H=-\sum_i p_i\log_2 p_i \;\approx\; 4.14\ \text{bits/letter} \]
The catch: Morse is not a prefix code. E=· is a prefix of I=··, which is a prefix of S=···. In pure symbols they're ambiguous. Morse resolves this in the time domain — the inter-element and inter-letter gaps are load-bearing information, not mere pauses. That third "symbol," silence of a specific length, is what makes the code work and what makes it strictly more than binary.

This is the bridge to binary: fixed-length codes like ASCII or Baudot (1870, the first 5-bit telegraph code) throw away the frequency weighting to gain a machine-friendly clock. Morse optimizes for a human ear; binary optimizes for a crystal oscillator.

09 — GNU Octave Lab

Same signal, in a scientific computer

Everything on this page reduces to arrays and timing, which is exactly Octave's home turf. These snippets run in Octave 7+ (most also in MATLAB). They cover encoding, audio synthesis with proper envelope shaping, spectral analysis of key clicks, decoding a signal back from its envelope, Farnsworth timing, and the information-theory numbers from the section above. Copy any block.

Note the leading 1; in snippets that define functions — it marks the file as a script so Octave permits inline function ... endfunction definitions. Save each block as its own .m file and run it, or paste into an interactive session.