This online ASCII code generator converts string to ASCII characters and ASCII characters to string.

HTML
CSS
JavaScript
<div id="converter">
  <div id="textareas">
    <textarea id="input" placeholder="Input"></textarea>
    <textarea id="output" placeholder="Output"></textarea>
  </div>
  <div id="converter-buttons">
    <span>
      <select id="conversion-type">
        <option value="string">Text to ASCII</option>
        <option value="dec">ASCII to Text</option>
      </select>
    </span>
    <button id="swap-values">Swap values</button>
  </div>
  <center><button id="convert">Convert to ASCII</button></center>
</div>
#converter {
  margin-top: 30px;
}
#textareas {
  display: flex;
  flex-direction: row;
}
#converter textarea {
  width: 50%;
  padding: 5px;
  min-height: 200px;
  font-size: 14px;
  color: #404040;
}
.applet-body {
  border: none !important;
}
#converter-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
}
#conversion-type, #swap-values {
  font-size: 15px;
  border-radius: 5px;
}
#convert {
  border: 1px solid #131f2d;
  background: #142944;
  color: #fff;
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 20px;
}
#convert:hover {
  background: #203754;
}
#guide {
  margin-top: 120px;
  font-size: 14px;
}
document.querySelector('#convert').onclick = function() {
  const inputMode = document.querySelector('#conversion-type').value;
  const input = document.querySelector('#input').value;
  if (!input) return;

  let output = '';

  if (inputMode === 'string') {
    input.split('').forEach(char => {
      output += char.charCodeAt(0) + ' ';
    });
  } else {
    input.split(' ').forEach(code => {
      output += String.fromCharCode(code);
    });
  }

  document.querySelector('#output').value = output;
}

document.querySelector('#swap-values').onclick = function() {
  const input = document.querySelector('#input').value;
  const output = document.querySelector('#output').value;
  document.querySelector('#input').value = output;
  document.querySelector('#output').value = input;
}

document.querySelector('#conversion-type').onchange = function() {
  if (document.querySelector('#conversion-type').value === 'string') {
    document.querySelector('#convert').innerText = 'Convert to ASCII';
  } else {
    document.querySelector('#convert').innerText = 'Convert to Text';
  }
}

Usage Guide#

American Standard Code for Information Interchange (ASCII) codes or characters are decimal representations of various printable and unprintable characters.

What can this ASCII generator do

This ASCII converter can generate the ASCII code of strings in a space-separated format. It can also convert a series of space-separated ASCII codes into their plain text equivalent.

How to use this ASCII generator

Type or paste the plain text in the input box on the left side. If you select "Text to ASCII" mode, the converter will convert the input into ASCII character codes. If you input space-separated ASCII codes, select "ASCII to Text" and click "Convert to Text", the converter will generate the plain text version of the ASCII codes.

You can click on the "Swap values" button to swap the contents of the input and output box.

Uses of an ASCII generator

An ASCII generator is a wonderful tool for finding out the ASCII code of a character or a string of chracters in plain text. Online ASCII generators don't require the installation of any additional software and return the results instantly.

References#

Tweet this | Share on LinkedIn |