Encoding / Decoding

Morse Code

Convert text to/from Morse code (dots and dashes).

Original
Morse Code

What is Morse Code?

Morse code represents letters and numbers using dots (.) and dashes (-). This tool converts text to Morse code and vice versa.

Features

  • Text to Morse conversion
  • Morse to text decoding
  • Audio playback support
  • Speed adjustment

Morse code converts text into the dots, dashes and gaps of International Morse, and reads such sequences back into letters. It covers the 54 characters of ITU-R M.1677-1: A–Z, 0–9 and 18 punctuation marks, with one space between letters and a slash between words. It suits learning the code or decoding a snippet from a radio log.

Timing is the encoding: gaps cannot be omitted

Morse is a variable-length on-off keying code and it is not prefix-free: E is a lone dot while A is dot-dash, so the opening dot of a letter is also the complete code for E. A receiver resolves characters from the length of the silences, and ITU-R M.1677-1 fixes those lengths in dot units: one unit for a dot, three for a dash, one unit of silence between elements, three between letters, seven between words. A text field cannot carry duration, so any text form has to substitute characters for the gaps — this tool writes one space between letters and / between words. Most decode failures start here: once the letter gap disappears, the element run is ambiguous and there is no dictionary to fall back on.

The table's 54 entries and what falls outside them

The map holds exactly 54 keys: 26 letters, 10 digits and 18 punctuation marks, including @ → .--.-., which the ITU only added in 2004. Code lengths run from one element (E, T) to seven (hyphen -....-, apostrophe .----.). Digits are always five elements and form two transposed halves: 1–5 begin with one to five dots (.---- through .....), 6–0 begin with one to five dashes (-.... through -----). Input is uppercased before lookup, so casing never survives. Characters outside the table pass through untouched when encoding but map to an empty string when decoding: hi 世界 encodes to .... .. / 世 界 and decodes back as HI .

Character substitution, not a byte encoding

Morse differs in kind from Base64, hex or percent-encoding. Those are byte-level transforms with a fixed radix that round-trip arbitrary binary input exactly. Morse predates electronics: no byte alignment, no padding, no fixed width, defined only for the characters above, and no way at all to send an arbitrary byte. It is also lossy in reverse. Encoding expands the text roughly fourfold — HELLO WORLD is 11 characters and becomes 43 — and decoding returns an uppercase approximation of the input, never its original casing. The practical split: reach for Morse when a human has to copy the message by ear, by lamp, or by key; reach for hex or Base64 when a program must recover the exact bytes.

Worked example

Mixed case and punctuation with one word break

Input
Hi, 73
Output
.... .. --..-- / --... ...--

Uppercasing happens first, so H and i both come from the capital table and decoding gives back HI, 73, not the original casing. The comma is one of the 18 punctuation keys and takes six elements, --..--. Letter gaps are single spaces and the word break is / , so 6 input characters become 28.

Limits and pitfalls

  • The letter separator is a free-text field: clearing it emits one continuous run, and decoding then splits on whitespace, finds no matching key and returns an empty string instead of an error.
  • The word separator can only be edited in encode mode; decoding splits on whatever value was left there (default /), so Morse arriving with newlines or | as word breaks decodes to letters glued together, such as HI73.
  • Anything outside the 54-entry table is kept verbatim during encoding but dropped during decoding, so encode-then-decode is not lossless: hi 世界 comes back as HI with a trailing space.
  • Upper-casing before lookup destroys case, so a round trip can only ever return one fixed casing.
  • The component sets no maximum length and recomputes on every keystroke on the main thread, and it cannot carry binary data or preserve line breaks, which are collapsed into word gaps.

Related tools

Five forks: when this page is the right one, and when it is not

What you are doingMorse tool on this pageWhat to reach for instead
The material is a recording or an off-air signal, not typed dotsThere is no audio path: the field takes characters, and the only gaps it can carry are one space between letters and / between words. The receiver timing has to become text by ear before anything lands here.fldigi, or the CW decoder built into a rig, reads the .wav, estimates the dot length and slices elements at 1, 3 and 7 units on its own. Hand it the audio — a transcription is only as good as the operator who made it.
The output has to return byte-for-byte to a programOnly the 54 keys have a code. Café 42 encodes to -.-. .- ..-. É / ....- ..---, with the accent riding along untouched, and decoding that string returns CAF 42: the É is dropped and the case was flattened before the lookup.Base64 or the hex tool encode bytes instead of looking characters up in a 54-entry map, so any byte survives and case is preserved. Switch whenever a program, rather than a person copying by ear, has to read the result.
You are practising copy by earThe result pane is characters on a screen, so time spent here trains the eye, and the letter gap is a text box: you can see it, never hear whether it was one unit or three.lcwo.net keys generated CW at a WPM you set and adds new characters in Koch order. Copy there, then bring the handwritten transcript back to this page to check it.
The message needs AR, BT or SKProsigns are not keys of their own. Typing AR yields .- .-. — two letters with a letter gap between them, which is not the sign. The pattern only appears if you type the character that shares it (+, =, & or (), and SK has no character at all.Send prosigns from a keyer or the rig memory, where AR goes out as one sign with 1-unit gaps between elements; use this page for the body text of the message only.
One callsign now, versus a list every weekOne paste gives one result. W1AW comes out as .-- .---- .- .--, 16 characters, so a log of 40 callsigns means 40 pastes and 40 copies.For anything recurring keep the dict in a script and run " ".join(CODE[ch] for ch in call.upper()). Every run after the first costs nothing and leaves a diff you can review.

The 18 punctuation keys, with code length and prosign collisions

CharacterCodeElementsSame pattern as
..-.-.-6—
,--..--6—
?..--..6—
!-.-.--6—
'.----.6—
".-..-.6—
:---...6—
;-.-.-.6—
--....-6—
_..--.-6—
/-..-.5—
(-.--.5KN
)-.--.-6—
&.-...5AS
=-...-5BT
+.-.-.5AR
$...-..-7—
@.--.-.6—

Digits are always five elements and are left out here: 1–5 start with one to five dots, 6–0 with one to five dashes. $ is the only seven-element key; everything else in the table is six or five. Four patterns double as ITU prosigns, which is why decoding .-.-. returns a plus sign rather than AR, and why the wait prosign AS has to be typed as &. SK (...-.-) has no key, so nothing sent as SK can be decoded here.

Frequently Asked Questions

How are letters and words separated in Morse code?
The standard rhythm: elements within a letter are 1 unit apart, letters are about 3 units apart, and words are about 7 units apart. This tool separates letters with a space and words with a slash, for both input and output.
Can Morse code represent Chinese?
Not directly. Morse only defines Latin letters, digits, and a few symbols. Chinese is sent by first converting each character to a 4-digit code from the standard Chinese telegraph code, then sending the digits. This tool covers letters, digits, and common punctuation.
Why did SOS become the international distress signal?
Not because of what it might abbreviate — ···−−−··· is simply the most recognizable rhythm: three short, three long, three short as one continuous sequence with no letter gaps. It was established by a 1906 international convention and gradually replaced the earlier CQD.

Content reviewed: