Morse Code Translator

Morse Code Translator is a free online tool that helps you clean up, change or check your text. Use it right on this page, with no sign-up and nothing to install.

: ‘…-..-‘, ‘@’: ‘.–.-.’, ‘ ‘: ‘/’ }; // Reverse Morse code mapping const reverseMorseCodeMap = Object.fromEntries( Object.entries(morseCodeMap).map(([key, value]) => [value, key]) ); function translateToMorse() { const text = textInput.value.trim().toUpperCase(); // Clear previous results or errors resultDiv.textContent = ”; errorDiv.textContent = ”; if (!text) { errorDiv.textContent = ‘Please enter some text.’; return; } // Convert text to Morse code const morseCode = text.split(”).map(char => { return morseCodeMap[char] || ”; }).join(‘ ‘); morseInput.value = morseCode; // Update Morse code field resultDiv.textContent = `Morse Code: ${morseCode}`; } function translateToText() { const morseCode = morseInput.value.trim(); // Clear previous results or errors resultDiv.textContent = ”; errorDiv.textContent = ”; if (!morseCode) { errorDiv.textContent = ‘Please enter some Morse code.’; return; } // Convert Morse code to text const text = morseCode.split(‘ ‘).map(code => { return reverseMorseCodeMap || ”; }).join(”); textInput.value = text; // Update text field resultDiv.textContent = `Text: ${text}`; } function playMorse() { const morseCode = morseInput.value.trim(); if (!morseCode) { errorDiv.textContent = ‘No Morse code to play.’; return; } // Play Morse code as audio const audioContext = new (window.AudioContext || window.webkitAudioContext)(); const dotDuration = 0.1; // Duration of a dot in seconds const dashDuration = 0.3; // Duration of a dash in seconds const spaceDuration = 0.2; // Duration of a space in seconds let time = audioContext.currentTime; morseCode.split(”).forEach(symbol => { if (symbol === ‘.’) { playBeep(audioContext, time, dotDuration); time += dotDuration; } else if (symbol === ‘-‘) { playBeep(audioContext, time, dashDuration); time += dashDuration; } else if (symbol === ‘ ‘) { time += spaceDuration; } }); } function playBeep(audioContext, startTime, duration) { const oscillator = audioContext.createOscillator(); const gainNode = audioContext.createGain(); oscillator.frequency.value = 600; // Frequency of the beep oscillator.connect(gainNode); gainNode.connect(audioContext.destination); oscillator.start(startTime); oscillator.stop(startTime + duration); } function copyMorse() { if (morseInput.value) { navigator.clipboard.writeText(morseInput.value) .then(() => alert(‘Morse code copied to clipboard!’)) .catch(() => alert(‘Failed to copy Morse code.’)); } else { alert(‘No Morse code to copy.’); } } function downloadMorse() { const morseCode = morseInput.value.trim(); if (!morseCode) { errorDiv.textContent = ‘No Morse code to download.’; return; } // Create a downloadable audio file const audioContext = new (window.AudioContext || window.webkitAudioContext)(); const dotDuration = 0.1; // Duration of a dot in seconds const dashDuration = 0.3; // Duration of a dash in seconds const spaceDuration = 0.2; // Duration of a space in seconds let time = 0; const audioBuffer = audioContext.createBuffer(1, audioContext.sampleRate * morseCode.length * dashDuration, audioContext.sampleRate); const bufferSource = audioContext.createBufferSource(); bufferSource.buffer = audioBuffer; morseCode.split(”).forEach(symbol => { if (symbol === ‘.’) { playBeep(audioContext, time, dotDuration); time += dotDuration; } else if (symbol === ‘-‘) { playBeep(audioContext, time, dashDuration); time += dashDuration; } else if (symbol === ‘ ‘) { time += spaceDuration; } }); bufferSource.start(); bufferSource.stop(time); const blob = new Blob([morseCode], { type: ‘text/plain’ }); const url = URL.createObjectURL(blob); const a = document.createElement(‘a’); a.href = url; a.download = ‘morse_code.txt’; a.click(); URL.revokeObjectURL(url); } function clearAll() { textInput.value = ”; morseInput.value = ”; resultDiv.textContent = ”; errorDiv.textContent = ”; } </script> <style>html,body{height:auto!important;min-height:0!important;max-height:none!important}</style><script>(function(){function wpcPost(){try{parent.postMessage({wpcId:261,wpcH:document.body.scrollHeight},’*’);}catch(e){}}window.addEventListener(‘load’,wpcPost);try{new MutationObserver(wpcPost).observe(document.body,{childList:true,subtree:true,attributes:true});}catch(e){}window.addEventListener(‘resize’,wpcPost);setInterval(wpcPost,600);})();</script></body> </html>” id=”wpc-frame-261″ class=”wpc-embed-frame” style=”width:100%;border:0;display:block;overflow:hidden;” scrolling=”no”>
 

How to use the Morse Code Translator

  1. Type or paste your input in “Text”.
  2. Type or paste your input in “Morse Code”.
  3. Click “Text to Morse”.
  4. Your result shows on the page. Use “Copy Morse” to copy it. Use “Clear All” to start again.

Why use this Morse Code Translator?

The Morse Code Translator is handy for writing, editing, coding, social media and study. It is free, easy to use and works on any device.

  • Save time on editing and formatting
  • Handy for students, writers, developers and marketers
  • Copy the result and use it anywhere

Morse Code Translator – frequently asked questions

Is the Morse Code Translator free to use?

Yes. The Morse Code Translator on Ilmhunt is free to use, and you do not need to create an account.

Do I need to install anything?

No installation is needed. Open this page and use the tool right away.

Is my data safe when I use the Morse Code Translator?

The tool runs in your browser, so what you enter is processed on your own device and is not sent to our servers.

Who can use the Morse Code Translator?

Anyone who works with text: students, writers, developers, teachers, marketers and more.

More free Text Tools

Browse all Text Tools on Ilmhunt, or see all free online tools.

Scroll to Top