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": ".----",
    "...": "...",
    ".": ".-.-.-",
    "@": ".--.-."
  },
  "phrases": [
    ["sos", "SOS"],
    ["mayday", "MAYDAY"],
    ["i-love-you", "I LOVE YOU"]
  ]
}
  • morseMap: canonical mapping. Keys are uppercase letters / digits / exact punctuation.
  • 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

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.