Embed the Morse Code Translator

Add a small, free Morse code translator to your own page with two lines of code. No sign-up, and no account.

To embed the Morse code translator, paste two lines into the HTML of your page: a div with the id morse-translator and a script from morsecodeworks.com. The widget translates text to Morse code and back, plays the sound, and works on any site that allows custom HTML with scripts.

Live preview

This is the real widget, running on this page. Type text or Morse code, press Play and try the speed menu.

The embed code

Copy these two lines into the place on your page where the translator should appear.

<div id="morse-translator"></div>
<script src="https://morsecodeworks.com/embed/widget-v1.js" async></script>

Select the code, copy it, and paste it into your page's HTML.

Options

You can set two optional attributes on the div:

Attribute What it does Example
data-text The message shown when the page loads data-text="SOS"
data-wpm The starting speed: 12, 20 or 30 words per minute data-wpm="12"
<div id="morse-translator" data-text="SOS" data-wpm="12"></div>
<script src="https://morsecodeworks.com/embed/widget-v1.js" async></script>

You can also use class="morse-translator" instead of the id, and put the widget on a page more than once.

What the widget does

  • Translates text to International Morse code, and Morse code back to text, in one box. It detects which one you typed.
  • Plays the Morse code as sound, with a choice of 12, 20 or 30 words per minute.
  • Copies the result.
  • Keeps its own styling, so your page's CSS does not change it and it does not change your page.

For the full tool, with the signal display, audio download, American Morse and more, use the Morse code translator.

Instructions for bloggers

  1. Open the page or post where the translator should appear.
  2. Add a Custom HTML block, or switch the editor to its HTML view.
  3. Paste the two lines of embed code and save or publish.
  4. Open the live page and check that the translator appears.

Some hosted platforms remove script tags from posts or limit them to paid plans. If the box does not appear, check your platform's rules for custom HTML, or link to the translator instead.

Instructions for teachers

  • Put the widget on a class page or learning-platform page that allows custom HTML, then ask students to translate their names, as in Morse code for kids.
  • For listening practice, use the Morse code trainer and the QSO simulator, which are separate pages.
  • To hand students a message to decode, use the Puzzle link button in the translator. It makes a link that hides the text until the student answers.
  • Print the Morse code chart as a reference sheet.

Privacy and attribution

The widget runs in your visitor's browser. The text they type is not sent to us or anyone else. Loading the script means the visitor's browser requests one file from morsecodeworks.com, as with any script or image on a web page.

The widget shows a small link, “Morse code translator by Morse Code Works”. Please leave it in place.

Why there is no iframe version

An iframe version would need our server to allow other sites to show our pages in a frame, and the server currently blocks that on purpose for safety. The script version avoids the problem.

Questions about embedding

Is the embed free?

Yes. It is free to use on personal, class and commercial sites. Please keep the attribution link.

Does it work on WordPress?

Yes, on WordPress sites that allow custom HTML with scripts. Use a Custom HTML block. Some WordPress.com plans and some security plugins remove scripts, in which case the widget will not appear.

Will it slow down my page?

The script is small and loads with the async attribute, so it does not block the rest of your page from loading.

Can I change the colours?

Not at present. The widget uses a neutral light style so it is readable on most pages.