{"id":3976,"date":"2025-03-27T20:03:09","date_gmt":"2025-03-27T10:03:09","guid":{"rendered":"https:\/\/www.runboats.com.au\/resources\/?page_id=3976"},"modified":"2026-10-21T19:28:19","modified_gmt":"2026-10-21T08:28:19","slug":"morse-code","status":"publish","type":"page","link":"https:\/\/www.runboats.com.au\/resources\/signalling-and-communication\/morse-code\/","title":{"rendered":"Morse code translator and alphabet"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Type a message below to see it in Morse code, then flash it on the signal lamp with the telegraph sound. On a boat, Morse is sent by flashing a torch or a spotlight, or by sound on a horn, and it reaches anyone in sight who can read it, with no radio needed.<\/p>\n\n\n\n<div class=\"rb-signal\" id=\"morse-signal-station\">\n    <h3 class=\"rb-signal__title\">Morse code signal station<\/h3>\n    <p class=\"rb-signal__sub\">Type a message to see it in Morse code, then flash it on the signal lamp with telegraph sound, or play SOS.<\/p>\n    <label class=\"rb-signal__label\" for=\"rb-morse-input\">Message<\/label>\n    <input type=\"text\" id=\"rb-morse-input\" class=\"rb-signal__input\" placeholder=\"e.g. RUN BOATS\" autocomplete=\"off\">\n    <div class=\"rb-signal__out\">\n        <span class=\"rb-signal__label\">Morse code<\/span>\n        <div id=\"rb-morse-output\" class=\"rb-signal__code\" aria-live=\"polite\"><\/div>\n    <\/div>\n    <div class=\"rb-signal__lampwrap\">\n        <div id=\"rb-signal-lamp\" class=\"rb-signal__lamp\" aria-hidden=\"true\"><\/div>\n        <span class=\"rb-signal__hint\">Signal lamp: flashes with the sound<\/span>\n    <\/div>\n    <div class=\"rb-signal__actions\">\n        <button type=\"button\" id=\"rb-btn-flash\" class=\"rb-signal__btn\">Flash signal<\/button>\n        <button type=\"button\" id=\"rb-btn-sos\" class=\"rb-signal__btn rb-signal__btn--sos\">Play SOS<\/button>\n        <button type=\"button\" id=\"rb-btn-stop\" class=\"rb-signal__btn rb-signal__btn--stop\" style=\"display:none\">Stop<\/button>\n    <\/div>\n<\/div>\n\n<script>\n(function() {\n    function initMorse() {\n        const input = document.getElementById('rb-morse-input');\n        const output = document.getElementById('rb-morse-output');\n        const lamp = document.getElementById('rb-signal-lamp');\n        const btnFlash = document.getElementById('rb-btn-flash');\n        const btnSos = document.getElementById('rb-btn-sos');\n        const btnStop = document.getElementById('rb-btn-stop');\n\n        if (!input || !output || !lamp || !btnFlash || !btnSos || !btnStop) return;\n\n        \/\/ Expanded Dictionary with Punctuation\n        const morseMap = {\n            'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....',\n            'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.',\n            'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-',\n            'Y': '-.--', 'Z': '--..', '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....',\n            '6': '-....', '7': '--...', '8': '---..', '9': '----.', '0': '-----', ' ': '\/',\n            '?': '..--..', '.': '.-.-.-', ',': '--..--', '!': '-.-.--'\n        };\n\n        let isFlashing = false;\n        \n        \/\/ Audio Synthesizer Setup\n        const AudioContext = window.AudioContext || window.webkitAudioContext;\n        let audioCtx;\n\n        function playBeep(durationMs) {\n            if (!audioCtx) audioCtx = new AudioContext();\n            if (audioCtx.state === 'suspended') audioCtx.resume();\n            \n            const oscillator = audioCtx.createOscillator();\n            const gainNode = audioCtx.createGain();\n            \n            oscillator.type = 'sine';\n            oscillator.frequency.value = 750; \/\/ Classic telegraph pitch\n            \n            \/\/ Prevent speaker clicking\/popping with quick fade in\/out\n            gainNode.gain.setValueAtTime(0, audioCtx.currentTime);\n            gainNode.gain.linearRampToValueAtTime(1, audioCtx.currentTime + 0.01);\n            gainNode.gain.setValueAtTime(1, audioCtx.currentTime + (durationMs\/1000) - 0.01);\n            gainNode.gain.linearRampToValueAtTime(0, audioCtx.currentTime + (durationMs\/1000));\n            \n            oscillator.connect(gainNode);\n            gainNode.connect(audioCtx.destination);\n            \n            oscillator.start(audioCtx.currentTime);\n            oscillator.stop(audioCtx.currentTime + (durationMs\/1000));\n        }\n\n        function translate() {\n            let text = input.value.toUpperCase();\n            let result = [];\n            for (let i = 0; i < text.length; i++) {\n                let char = text[i];\n                if (morseMap[char]) {\n                    result.push(morseMap[char]);\n                }\n            }\n            output.innerText = result.join(' ');\n        }\n\n        input.addEventListener('input', translate);\n\n        const sleep = ms => new Promise(r => setTimeout(r, ms));\n\n        async function triggerFlash(forceCode = null) {\n            if (isFlashing) return;\n            \n            \/\/ If SOS is pressed, inject it temporarily\n            const codeText = forceCode ? forceCode : output.innerText;\n            if (!codeText) return;\n\n            if (forceCode) {\n                input.value = \"SOS\";\n                output.innerText = \"... --- ...\";\n            }\n\n            isFlashing = true;\n            btnFlash.style.display = 'none';\n            btnSos.style.display = 'none';\n            btnStop.style.display = 'block';\n\n            \/\/ Timing in milliseconds (Standard WPM timing)\n            const DOT = 150;\n            const DASH = 450;\n            const INTRA_CHAR_GAP = 150; \n            const SHORT_GAP = 450;      \n            const MEDIUM_GAP = 1050;    \n\n            \/\/ Ensure AudioContext starts correctly (browsers block audio until a user clicks)\n            if (!audioCtx) audioCtx = new AudioContext();\n            if (audioCtx.state === 'suspended') await audioCtx.resume();\n\n            for (let i = 0; i < codeText.length; i++) {\n                if (!isFlashing) break;\n\n                let symbol = codeText[i];\n\n                if (symbol === '.' || symbol === '-') {\n                    const duration = symbol === '.' ? DOT : DASH;\n                    \n                    \/\/ Turn Light ON &#038; Play Audio\n                    lamp.style.backgroundColor = '#ffd200';\n                    lamp.style.boxShadow = '0 0 25px #ffd200';\n                    playBeep(duration);\n                    \n                    await sleep(duration);\n                    \n                    \/\/ Turn Light OFF\n                    lamp.style.backgroundColor = '#eee';\n                    lamp.style.boxShadow = 'none';\n                    \n                    await sleep(INTRA_CHAR_GAP);\n                } else if (symbol === ' ') {\n                    await sleep(SHORT_GAP);\n                } else if (symbol === '\/') {\n                    await sleep(MEDIUM_GAP);\n                }\n            }\n            resetLamp();\n        }\n\n        function resetLamp() {\n            isFlashing = false;\n            btnFlash.style.display = 'block';\n            btnSos.style.display = 'block';\n            btnStop.style.display = 'none';\n            lamp.style.backgroundColor = '#eee';\n            lamp.style.boxShadow = 'none';\n        }\n\n        btnFlash.addEventListener('click', () => triggerFlash(null));\n        btnSos.addEventListener('click', () => triggerFlash('... --- ...'));\n        btnStop.addEventListener('click', function() {\n            isFlashing = false; \n            resetLamp();\n        });\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initMorse);\n    } else {\n        initMorse();\n    }\n})();\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\">The Morse alphabet<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The letters and figures of the international code, as set out by the International Telecommunication Union in <a href=\"https:\/\/www.itu.int\/rec\/R-REC-M.1677-1-200910-I\/en\">Recommendation ITU-R M.1677-1<\/a>. A dot is shown as \u00b7 and a dash as \u2212.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Letter<\/th><th>Code<\/th><th>Letter<\/th><th>Code<\/th><\/tr><\/thead><tbody><tr><td>A<\/td><td>\u00b7\u2212<\/td><td>N<\/td><td>\u2212\u00b7<\/td><\/tr><tr><td>B<\/td><td>\u2212\u00b7\u00b7\u00b7<\/td><td>O<\/td><td>\u2212\u2212\u2212<\/td><\/tr><tr><td>C<\/td><td>\u2212\u00b7\u2212\u00b7<\/td><td>P<\/td><td>\u00b7\u2212\u2212\u00b7<\/td><\/tr><tr><td>D<\/td><td>\u2212\u00b7\u00b7<\/td><td>Q<\/td><td>\u2212\u2212\u00b7\u2212<\/td><\/tr><tr><td>E<\/td><td>\u00b7<\/td><td>R<\/td><td>\u00b7\u2212\u00b7<\/td><\/tr><tr><td>F<\/td><td>\u00b7\u00b7\u2212\u00b7<\/td><td>S<\/td><td>\u00b7\u00b7\u00b7<\/td><\/tr><tr><td>G<\/td><td>\u2212\u2212\u00b7<\/td><td>T<\/td><td>\u2212<\/td><\/tr><tr><td>H<\/td><td>\u00b7\u00b7\u00b7\u00b7<\/td><td>U<\/td><td>\u00b7\u00b7\u2212<\/td><\/tr><tr><td>I<\/td><td>\u00b7\u00b7<\/td><td>V<\/td><td>\u00b7\u00b7\u00b7\u2212<\/td><\/tr><tr><td>J<\/td><td>\u00b7\u2212\u2212\u2212<\/td><td>W<\/td><td>\u00b7\u2212\u2212<\/td><\/tr><tr><td>K<\/td><td>\u2212\u00b7\u2212<\/td><td>X<\/td><td>\u2212\u00b7\u00b7\u2212<\/td><\/tr><tr><td>L<\/td><td>\u00b7\u2212\u00b7\u00b7<\/td><td>Y<\/td><td>\u2212\u00b7\u2212\u2212<\/td><\/tr><tr><td>M<\/td><td>\u2212\u2212<\/td><td>Z<\/td><td>\u2212\u2212\u00b7\u00b7<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Figure<\/th><th>Code<\/th><th>Figure<\/th><th>Code<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>\u00b7\u2212\u2212\u2212\u2212<\/td><td>6<\/td><td>\u2212\u00b7\u00b7\u00b7\u00b7<\/td><\/tr><tr><td>2<\/td><td>\u00b7\u00b7\u2212\u2212\u2212<\/td><td>7<\/td><td>\u2212\u2212\u00b7\u00b7\u00b7<\/td><\/tr><tr><td>3<\/td><td>\u00b7\u00b7\u00b7\u2212\u2212<\/td><td>8<\/td><td>\u2212\u2212\u2212\u00b7\u00b7<\/td><\/tr><tr><td>4<\/td><td>\u00b7\u00b7\u00b7\u00b7\u2212<\/td><td>9<\/td><td>\u2212\u2212\u2212\u2212\u00b7<\/td><\/tr><tr><td>5<\/td><td>\u00b7\u00b7\u00b7\u00b7\u00b7<\/td><td>0<\/td><td>\u2212\u2212\u2212\u2212\u2212<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">E is a single dot and T a single dash, while every figure takes five signals.<\/p>\n\n\n\n<div class=\"rb-signal\" id=\"morse-alphabet\">\n    <h3 class=\"rb-signal__title\">Interactive Morse alphabet<\/h3>\n    <p class=\"rb-signal__sub\">Tap a character to see it flash and hear its telegraph sound.<\/p>\n    <p class=\"rb-signal__group\">Letters<\/p>\n    <div id=\"rb-sb-letters\" class=\"rb-signal__board\"><\/div>\n    <p class=\"rb-signal__group\">Numbers<\/p>\n    <div id=\"rb-sb-numbers\" class=\"rb-signal__board\"><\/div>\n<\/div>\n\n<script>\n(function() {\n    function initSoundboard() {\n        const lettersContainer = document.getElementById('rb-sb-letters');\n        const numbersContainer = document.getElementById('rb-sb-numbers');\n        \n        if (!lettersContainer || !numbersContainer) return;\n\n        const morseMap = {\n            'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....',\n            'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.',\n            'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-',\n            'Y': '-.--', 'Z': '--..',\n            '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....',\n            '6': '-....', '7': '--...', '8': '---..', '9': '----.', '0': '-----'\n        };\n\n        const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');\n        const numbers = '1234567890'.split('');\n\n        \/\/ Function to create a button element\n        function createButton(char, code) {\n            const btn = document.createElement('button');\n            btn.type = 'button';\n            btn.className = 'rb-sb-btn';\n            btn.innerHTML = `<div class=\"rb-sb-char\">${char}<\/div><div class=\"rb-sb-morse\">${code}<\/div>`;\n            \n            btn.addEventListener('click', () => playMorseSequence(btn, code));\n            return btn;\n        }\n\n        \/\/ Inject buttons into the grid\n        letters.forEach(char => lettersContainer.appendChild(createButton(char, morseMap[char])));\n        numbers.forEach(char => numbersContainer.appendChild(createButton(char, morseMap[char])));\n\n        \/\/ Audio Setup\n        const AudioContext = window.AudioContext || window.webkitAudioContext;\n        let audioCtx;\n        let isPlaying = false; \/\/ Prevent overlapping sounds\n\n        const sleep = ms => new Promise(r => setTimeout(r, ms));\n\n        function playTone(durationMs) {\n            if (!audioCtx) audioCtx = new AudioContext();\n            if (audioCtx.state === 'suspended') audioCtx.resume();\n            \n            const osc = audioCtx.createOscillator();\n            const gain = audioCtx.createGain();\n            \n            osc.type = 'sine';\n            osc.frequency.value = 750;\n            \n            gain.gain.setValueAtTime(0, audioCtx.currentTime);\n            gain.gain.linearRampToValueAtTime(1, audioCtx.currentTime + 0.01);\n            gain.gain.setValueAtTime(1, audioCtx.currentTime + (durationMs\/1000) - 0.01);\n            gain.gain.linearRampToValueAtTime(0, audioCtx.currentTime + (durationMs\/1000));\n            \n            osc.connect(gain);\n            gain.connect(audioCtx.destination);\n            \n            osc.start(audioCtx.currentTime);\n            osc.stop(audioCtx.currentTime + (durationMs\/1000));\n        }\n\n        async function playMorseSequence(buttonEl, code) {\n            if (isPlaying) return; \/\/ Wait for current sequence to finish\n            isPlaying = true;\n            \n            if (!audioCtx) audioCtx = new AudioContext();\n            if (audioCtx.state === 'suspended') await audioCtx.resume();\n\n            const DOT = 150;\n            const DASH = 450;\n            const GAP = 150;\n\n            for (let i = 0; i < code.length; i++) {\n                let symbol = code[i];\n                let duration = (symbol === '.') ? DOT : DASH;\n\n                buttonEl.classList.add('is-playing');\n                playTone(duration);\n                await sleep(duration);\n                \n                buttonEl.classList.remove('is-playing');\n                if (i < code.length - 1) {\n                    await sleep(GAP);\n                }\n            }\n            isPlaying = false;\n        }\n    }\n\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', initSoundboard);\n    } else {\n        initSoundboard();\n    }\n})();\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\">How Morse is timed<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Morse runs on one unit of time, the length of a dot. The ITU recommendation fixes everything else from it:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A dash lasts three dots.<\/li>\n\n\n\n<li>The gap between the dots and dashes of one letter is one dot.<\/li>\n\n\n\n<li>The gap between letters is three dots.<\/li>\n\n\n\n<li>The gap between words is seven dots.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">How long the dot itself lasts is up to the sender. A slow message with clean proportions reads better than a fast one with ragged gaps. The International Code of Signals treats 40 letters a minute as the standard rate for flashing light, and advises making dots a little shorter than strict proportion so they can't be mistaken for dashes (<a href=\"https:\/\/msi.nga.mil\/Publications\/ICOS\">International Code of Signals, chapter 1<\/a>).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sending by light<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Aim a torch or spotlight at the boat or the shore you're signalling, and keep it pointed there for the whole message. A light with a push button that stays lit only while it's held down is much easier to send with than one that latches on and off. Under the International Code, a message by flashing light goes in four parts:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The call: AA AA AA, repeated until the other station answers with a string of Ts.<\/li>\n\n\n\n<li>DE followed by your boat's name.<\/li>\n\n\n\n<li>The message itself. The receiver flashes T after each word to show it was read.<\/li>\n\n\n\n<li>The ending signal AR, which the receiver answers with R.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">If you make a mistake, send a string of Es, then start again from the last word that went through correctly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Procedure signals worth knowing<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Signal<\/th><th>Code<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td>SOS<\/td><td>\u00b7\u00b7\u00b7\u2212\u2212\u2212\u00b7\u00b7\u00b7<\/td><td>Distress, sent as one group with no gaps between the letters<\/td><\/tr><tr><td>AR<\/td><td>\u00b7\u2212\u00b7\u2212\u00b7<\/td><td>End of the message<\/td><\/tr><tr><td>K<\/td><td>\u2212\u00b7\u2212<\/td><td>Invitation to transmit, over to you<\/td><\/tr><tr><td>AS<\/td><td>\u00b7\u2212\u00b7\u00b7\u00b7<\/td><td>Wait<\/td><\/tr><tr><td>T<\/td><td>\u2212<\/td><td>Word received<\/td><\/tr><tr><td>R<\/td><td>\u00b7\u2212\u00b7<\/td><td>Message received<\/td><\/tr><tr><td>Error<\/td><td>\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7<\/td><td>Eight dots: the last word was wrong<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">SOS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">SOS in Morse code, by radio, light or sound, is one of the distress signals in the International Regulations for Preventing Collisions at Sea, and those rules prohibit using it for anything except a vessel in distress (they're reproduced in <a href=\"https:\/\/msi.nga.mil\/Publications\/ICOS\">chapter 4 of the International Code of Signals<\/a>). Practise with the converter on this page, not with a torch pointed at other boats.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In a real emergency, <a href=\"https:\/\/www.runboats.com.au\/resources\/signalling-and-communication\/\">call on VHF channel 16 or set off a distress beacon<\/a> first. A flashing SOS helps rescuers find you once they're close, especially at night.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Translate text to Morse code as you type, with the Morse alphabet, how dots and dashes are timed and how a message is sent by light or radio.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3971,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-3976","page","type-page","status-publish","hentry","category-converters"],"_links":{"self":[{"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/pages\/3976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/comments?post=3976"}],"version-history":[{"count":5,"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/pages\/3976\/revisions"}],"predecessor-version":[{"id":4883,"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/pages\/3976\/revisions\/4883"}],"up":[{"embeddable":true,"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/pages\/3971"}],"wp:attachment":[{"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/media?parent=3976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/categories?post=3976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.runboats.com.au\/resources\/wp-json\/wp\/v2\/tags?post=3976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}