Use our simple API to convert text to Morse code programmatically:
Endpoint: (Use the functions directly in your JavaScript code)
Text to Morse: textToMorse(text, options)
Morse to Text: morseToText(morseCode, options)
Options: {
dotDuration: 50, // ms
dashDuration: 150, // ms
pauseDuration: 50 // ms
}
Example usage:
// Convert text to Morse
const morse = textToMorse("Hello");
console.log(morse); // ".... . .-.. .-.. ---"
// Convert Morse to text
const text = morseToText(".... . .-.. .-.. ---");
console.log(text); // "HELLO"
Morse Code Basics
Morse code is a method used in telecommunication to encode text characters as standardized sequences of two different signal durations, called dots and dashes.