Morse Code API: Free REST API for Developers
Encode and decode Morse code programmatically. Free, no authentication, CORS-enabled. Instant JSON responses.
Base URL
https://morse.cool/api/v1/Quick Start
Encode text to Morse code with a single request:
curl "https://morse.cool/api/v1/encode?text=HELLO%20WORLD"
# Response:
{
"success": true,
"input": "HELLO WORLD",
"output": ".... . .-.. .-.. --- / .-- --- .-. .-.. -..",
"characters": 11
}Endpoints
/api/v1/encodeEncode text to Morse code
Parameters
| Name | Type | Description |
|---|---|---|
textrequired | string | Text to encode |
separatoroptional | string | Word separator(Default: " / ") |
dotCharoptional | string | Character for dots(Default: ".") |
dashCharoptional | string | Character for dashes(Default: "-") |
Example Response
{
"success": true,
"input": "HELLO WORLD",
"output": ".... . .-.. .-.. --- / .-- --- .-. .-.. -..",
"characters": 11
}/api/v1/decodeDecode Morse code to text
Parameters
| Name | Type | Description |
|---|---|---|
morserequired | string | Morse code string to decode |
Example Response
{
"success": true,
"input": ".... . .-.. .-.. ---",
"output": "HELLO",
"characters": 5
}/api/v1/chartGet the full Morse code alphabet, numbers, and punctuation
Example Response
{
"success": true,
"alphabet": {
"A": ".-",
"B": "-...",
"C": "-.-.",
"...": "..."
},
"numbers": {
"0": "-----",
"1": ".----",
"...": "..."
},
"punctuation": {
".": ".-.-.-",
",": "--..--",
"...": "..."
}
}/api/v1/audioGet audio timing data for Morse code playback
Parameters
| Name | Type | Description |
|---|---|---|
textrequired | string | Text to encode |
wpmoptional | number | Words per minute (5-50)(Default: 20) |
frequencyoptional | number | Tone frequency in Hz (200-1000)(Default: 600) |
Example Response
{
"success": true,
"text": "SOS",
"morse": "... --- ...",
"wpm": 20,
"frequency": 600,
"unitMs": 60,
"sequence": [
{
"type": "dot",
"startMs": 0,
"durationMs": 60
},
{
"type": "silence",
"startMs": 60,
"durationMs": 60
},
"..."
]
}API Playground
Test any endpoint live — results appear instantly.
/api/v1/encodeQuery Parameters
Response
Click 'Send Request' to see the responseError Handling
All errors return a JSON object with success: false and an error message:
{
"success": false,
"error": "Missing required parameter: text"
}Max input length: 1000 characters
Rate Limits & CORS
The API is free with no authentication required. CORS headers are included on all responses, so you can call it directly from browser JavaScript. Rate limit headers are informational.
Code Examples
// JavaScript (fetch)
const response = await fetch("https://morse.cool/api/v1/encode", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: "HELLO WORLD" })
});
const data = await response.json();
console.log(data.output); // ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."# Python (requests)
import requests
response = requests.post("https://morse.cool/api/v1/encode", json={
"text": "HELLO WORLD"
})
data = response.json()
print(data["output"]) # ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."# cURL — decode Morse back to text
curl -X POST "https://morse.cool/api/v1/decode" \
-H "Content-Type: application/json" \
-d '{"morse": ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."}'
# Response: {"success":true,"input":".... . .-.. .-.. --- / .-- --- .-. .-.. -..","output":"HELLO WORLD","characters":10}Frequently Asked Questions
Is the Morse Code API free?
Yes, the Morse Code API is completely free to use. No API key, authentication, or registration is required. Simply send HTTP requests to the endpoints and receive JSON responses.
Does the API support CORS?
Yes. All API responses include CORS headers (Access-Control-Allow-Origin: *), so you can call the API directly from browser-based JavaScript applications without any proxy.
What endpoints are available?
The API provides four endpoints: /api/v1/encode (text to Morse), /api/v1/decode (Morse to text), /api/v1/chart (full alphabet reference), and /api/v1/audio (timing data for audio playback).
What is the maximum input length?
The API accepts inputs up to 1000 characters. Requests exceeding this limit will receive an error response. Both GET query parameters and POST JSON bodies are supported.
Why Use a Morse Code API?
A Morse code API enables developers to integrate Morse code encoding and decoding directly into their applications without implementing the conversion logic themselves. Whether you're building an educational app, a communication tool, a game, or a creative project, a REST API provides a simple and reliable way to convert text to Morse code and back. The morse.cool API is free, requires no authentication, and supports CORS — making it perfect for frontend JavaScript applications, mobile apps, and server-side integrations alike.
API Features and Capabilities
The Morse Code API at morse.cool provides four main endpoints: encode (text to Morse), decode (Morse to text), chart (full alphabet reference), and audio (timing data for sound generation). The encode endpoint supports custom dot and dash characters, allowing you to render Morse code with any symbols you prefer. The audio endpoint returns precise timing data based on standard Morse code timing rules, where a dash is three times the length of a dot, and word gaps are seven times the dot length. All endpoints support both GET and POST methods for maximum flexibility.
Integration Examples and Use Cases
Developers use the Morse Code API in diverse projects: educational platforms that teach Morse code to students, Arduino and IoT projects that flash LEDs in Morse patterns, chat applications with secret Morse messaging modes, accessibility tools that convert text to tactile signals, escape room puzzles, and retro-themed games. The API's JSON responses make it easy to parse and display results in any programming language or framework. The lightweight responses ensure fast performance even on slow connections.
Technical Details and Standards
The API follows the International Morse Code standard (ITU-R M.1677) for character encoding. Timing calculations adhere to the PARIS standard where one word unit equals 50 dot lengths, resulting in the formula: dot duration = 1200 / WPM milliseconds. The API accepts inputs up to 1000 characters and returns properly formatted JSON with consistent response structures. CORS headers (Access-Control-Allow-Origin: *) are included on all responses, and rate limit headers provide informational usage guidance.
Getting Started with the API
Getting started is as simple as making a single HTTP request. No API key, no registration, no setup — just send a request to https://morse.cool/api/v1/encode?text=HELLO and receive an instant JSON response. The interactive playground above lets you test all endpoints directly in your browser before writing any code. For production use, we recommend using POST requests with JSON bodies for better handling of special characters and longer texts. Morse code translator