Static • Free • No API key
Morse code API & data
We publish the canonical Morse character map and common-phrase list as a single static JSON file served from our CDN. Use it from a browser, server, or AI agent — no key, no rate limits, just please attribute (see /ai.txt).
Endpoint
GET https://morsecodegenerator.com/morse.json CORS: Access-Control-Allow-Origin: * · CDN-cached.
Schema
{
"morseMap": {
"A": ".-",
"B": "-...",
"...": "...",
"0": "-----",
"1": ".----",
"...": "...",
".": ".-.-.-",
"@": ".--.-."
},
"extendedMap": {
"É": "..-..",
"Ñ": "--.--"
},
"phrases": [
["sos", "SOS"],
["mayday", "MAYDAY"],
["i-love-you", "I LOVE YOU"]
]
} - morseMap: canonical mapping. Keys are uppercase letters / digits / exact punctuation.
- extendedMap: letters outside the basic set — É, the one accented letter in ITU-R M.1677-1, and Ñ, the Spanish addition. Kept separate so a strict ITU implementation can ignore it; merge it over morseMap if you want them.
- phrases: array of [slug, PHRASE] pairs (uppercase phrase).
Quick examples
JavaScript (browser or Node)
const data = await fetch("https://morsecodegenerator.com/morse.json").then(r => r.json());
const map = data.morseMap;
function textToMorse(text) {
return text.toUpperCase().split(/\s+/).filter(Boolean)
.map(w => w.split("").map(c => map[c] || "").filter(Boolean).join(" "))
.join(" / ");
}
console.log(textToMorse("Hello world")); // .... . .-.. .-.. --- / .-- --- .-. .-.. -.. Python
import json, urllib.request
data = json.load(urllib.request.urlopen("https://morsecodegenerator.com/morse.json"))
m = data["morseMap"]
def text_to_morse(s):
return " / ".join(
" ".join(m[c] for c in w if c in m)
for w in s.upper().split()
)
print(text_to_morse("Hello world")) cURL
curl https://morsecodegenerator.com/morse.json | jq .morseMap.A What you get, exactly
The file is 54 characters and 56 phrases — about 2.0 KB of JSON, small enough to fetch once at start-up and keep in memory. It is a static file on a CDN, not a service: there is no key, no quota and no rate limit, and nothing about your request is logged back to you.
- Every pattern is unique. No two characters share a dot-dash sequence, so you can build a reverse map straight from morseMap and decode with it.
- Keys are uppercase. Upper-case your input before looking it up; lowercase keys do not exist in the file.
- Unmapped characters. Accented letters, ¿, ¡, #, * and emoji are not in the map. Decide deliberately whether to skip them or report them — silently dropping characters is the most common bug in Morse converters.
- Not included. Prosigns, Q-codes and CW abbreviations are not in this file; they are published as pages at /prosigns/, /q-codes/ and /abbreviations/.
Caching and stability
Responses are sent with Cache-Control: public, max-age=300, s-maxage=86400, stale-while-revalidate=604800, so browsers hold a copy for five minutes and the CDN for a day. Please cache on your side too rather than fetching the file on every conversion.
The character map follows Recommendation ITU-R M.1677-1 and is not going to change: codes are only ever added, never redefined, and morseMap and phrases keep their shape. The same file powers every tool on this site, so if a pattern here were wrong the site would be wrong with it.
Conventions
- Letter separator inside a word: " " (single space).
- Word separator: " / " (space-slash-space).
- Standard PARIS WPM timing: 1 unit ms = 1200 / WPM.
- Standard tone: 600–700 Hz (pleasant for ear training).
Attribution
Use is free for any purpose including commercial. Please credit: MorseCodeGenerator.com with a link to https://morsecodegenerator.com/. Full machine-readable policy at /ai.txt.