Skip to content
📻

Morse Code Translator

Translate text to morse code and back, with audio playback.

Runs in your browser

Updated

Dots, dashes and a slash

The text is uppercased, then each character is looked up in a fixed table of 26 letters, 10 digits and 18 punctuation marks. Codes are joined with single spaces, so every space you type becomes a slash. "SOS 42" encodes to "... --- ... / ....- ..---". Decoding splits on whitespace, turns a slash into a space and maps codes back.

A worked example

That string is 25 characters and decodes to "SOS 42" in capitals, because morse has no lower case. Decoding ".... .. / - .... . .-. ." returns "HI THERE", and playing that code takes 5.04 seconds; "SOS" alone takes 2.52.

The sound it makes

Playback builds a 700 Hz sine wave. One unit is 90 ms, so a dot sounds for 90 ms and a dash for 270, each followed by 90 ms of silence. Letter gaps are 180 ms and word gaps 540, shorter than the 3 and 7 units of the international standard, and the stop timer is scheduled after a trailing gap that nothing plays into.

Characters it does not know

Encoding drops anything absent from the table: "café" becomes "-.-. .- ..-." and the accented letter is gone, while the note says unmapped characters are skipped. Decoding is more forthcoming, replacing each unknown code with a question mark, so "........" returns a single "?" with the message "1 code could not be decoded, shown as ?."

Where it stops

  • No accented letters, Cyrillic, Greek or prosigns; the table holds 54 entries.
  • Case is lost in both directions, and punctuation outside the 18 marks is discarded.
  • Gaps use 2 and 6 unit spacing rather than the standard 3 and 7.
  • No volume control and no audio file to download.

Questions people ask

Can I paste morse with slashes and line breaks?

Yes. Any run of spaces, tabs or newlines counts as one separator, and a slash on its own always becomes a space rather than a character.

Why does the decoded text come back in capitals?

Because the table only has upper-case letters. Retitle the output with the case converter, or see the same characters as eight-bit groups with the text to binary converter.