Ascii Converter - Text, Hex, Binary, and Octal
ASCII converter for text to codes and codes to text. Pick decimal, hex, binary, or octal bases, choose a separator, and read the result right away.
Ascii Converter
Results
What Is Ascii Converter?
An ASCII converter is a quick text utility that turns readable characters into their numeric ASCII codes and turns numeric codes back into readable text. The same calculator works in both directions: you can type a short message and see decimal, hex, octal, or binary codes for each character, or paste a list of codes and get the matching string back. Because ASCII is the 7-bit code table used by almost every text format on the web, the same numbers work for debugging log output, reviewing email headers, and reading binary or hex dumps.
- • Decoding log output and packet captures: Read short text fragments buried inside a hex or decimal dump, the way network and developer logs often display them.
- • Encoding data for embedded systems: Convert a command string into hex or decimal codes for firmware that stores text as raw byte values.
- • Teaching the ASCII table: Show students how each letter, digit, and punctuation mark maps to a fixed 0-127 code point, with one example per category.
- • Sanitizing pasted codes: Strip stray characters and split a list of codes so the same list can be re-typed or fed into a different base.
The calculator covers 7-bit US-ASCII, the 0-127 code range that ANSI X3.4-1986 standardized for English text and basic control codes. Any character outside that range (accented letters, emoji, CJK characters) is out of scope, and the calculator surfaces a warning so the mismatch is visible.
If you only need the binary bit pattern and want a focused tool, the text to binary converter gives you the 8-bit representation of each character on a single base, while this calculator keeps decimal, hex, and octal on the same screen.
How Ascii Converter Works
The converter walks the input one token at a time, reads the matching code point from the ASCII table, and renders it in the base you selected. Encoding works on a plain string; decoding works on a list of numeric tokens separated by a chosen delimiter. The same code points appear in both directions, so a round-trip keeps the original text as long as the bases and separator match.
- inputString: The text to encode. Each character is read with charCodeAt and rendered in the chosen base.
- codeString: A list of numeric tokens to decode. Tokens are split on the chosen separator and parsed in the chosen base.
- encodeBase: Numeric base used to format the codes you see in Encode mode: 10 (decimal), 16 (hex), 8 (octal), or 2 (binary).
- decodeBase: Numeric base used to read the code tokens in Decode mode.
- separator: Character placed between codes for readability: a space, a comma, or no separator. With no separator and a binary decode base, the parser falls back to 7-bit chunks.
- mode: Encode walks the text and outputs codes. Decode walks the codes and outputs text.
The encoding step is the same regardless of base; only the formatting changes. Hexadecimal drops the leading 0x and uppercases the digits, octal uses base 8, decimal prints the raw integer, and binary pads each value to 7 bits so the result lines up cleanly. Decoding is the reverse: a token is parsed in the chosen base, the value is checked against the 0-127 ASCII range, and String.fromCharCode turns the value back into a character. The no-separator binary combination is the exception: the parser reads the input as a bit run and slices it into 7-bit chunks.
Encode 'Hi!' to decimal codes
Text = 'Hi!', Encode base = 10 (decimal), Separator = space
1. 'H' has charCodeAt 72 -> 72. 2. 'i' has charCodeAt 105 -> 105. 3. '!' has charCodeAt 33 -> 33. 4. Join with a space: 72 105 33.
Encoded output: 72 105 33. Character count: 3. Byte count: 3.
Three printable characters, three 7-bit ASCII bytes. The output is small enough to paste into a one-line comment or a log file.
Decode hex codes 48 65 6C 6C 6F back to text
Codes = '48 65 6C 6C 6F', Decode base = 16 (hex), Separator = space
1. Split on spaces: [48, 65, 6C, 6C, 6F]. 2. parseInt each token in base 16: [72, 101, 108, 108, 111]. 3. String.fromCharCode of each: 'H', 'e', 'l', 'l', 'o'. 4. Join the characters: 'Hello'.
Decoded text: Hello. Character count: 5. Byte count: 5.
The same five bytes show up either as decimal 72 101 108 108 111 or hex 48 65 6C 6C 6F. Switching bases does not change the underlying characters; for a side-by-side view of the binary and hex forms of the same code, the binary to hexadecimal calculator lays both bases out in one place.
According to ECMA International ECMA-6, decimal 65 is the uppercase letter A and decimal 97 is the lowercase letter a, and the rest of the printable alphabet follows the same fixed offsets.
Key Concepts Explained
Four small ideas explain every result the ASCII converter shows.
7-bit ASCII Range (0-127)
ASCII reserves decimal 0-31 and 127 for control codes such as NUL, tab, line feed, and DEL, and uses 32-126 for printable characters. The calculator only covers this 128-code set, which is what the original US-ASCII standard defines.
Char Code Lookup
charCodeAt returns the numeric code for a character at a given index. In Encode mode the calculator calls charCodeAt on every character of the input string and formats the result in the chosen base.
Base Conversion
Decimal, hex, octal, and binary are different ways of writing the same integer. 65 decimal is 0x41 in hex, 101 in octal, and 1000001 in binary. The calculator lets you switch bases without changing the underlying character.
Token Separator Parsing
In Decode mode the code string is split on the chosen separator. With a space or comma, each token is parsed in the selected base. With no separator and a binary decode base, the parser strips non-bit characters and slices the run into 7-bit chunks, the encode width.
These four ideas line up with what the calculator actually does: read a code from the table, format it in the chosen base, and rebuild the same string when the bases and separator are consistent. When the input goes past 127, the calculator does not silently fail; it flags the out-of-range code so you can see exactly which character broke the round trip, which is the same behavior the unicode text calculator uses to keep its own code points auditable.
How to Use This Calculator
Five short steps cover both Encode and Decode without any setup.
- 1 Pick the conversion mode: Use Encode to turn text into codes. Use Decode to turn codes into text.
- 2 Choose the input field that matches your mode: Encode reads the Text Input field. Decode reads the ASCII Code Input field.
- 3 Select the base: Use decimal for everyday numbers, hex for code reviews, octal for legacy systems, and binary when you need to see the exact bit pattern.
- 4 Pick a separator that fits the codes: A space is the most readable default. Comma-separated values paste cleanly into spreadsheets. With the binary base, 'no separator' runs the 7-bit chunks together without spaces.
- 5 Read the result and the counts: The result panel shows the encoded code list or the decoded text, plus the character count and the byte count, so you can confirm the round-trip.
If you paste the codes 72 101 108 108 111 with the decode base set to decimal and the separator set to space, the calculator splits the input into five tokens, parses each as a base-10 number, and rebuilds the text 'Hello'. Switching the decode base to 16 and pasting 48 65 6C 6C 6F gives the same result.
Benefits of Using This Calculator
A purpose-built ASCII converter keeps the table consistent, the bases consistent, and the input parsing forgiving.
- • One tool for four bases: Decimal, hex, octal, and binary codes are available from the same calculator, so you do not need to switch tools when the same string appears in multiple representations.
- • Bidirectional without copy-paste risk: Encoding and decoding share the same input fields and the same bases, which makes round-trip testing easy and reduces the chance of pasting codes into the wrong field.
- • Visible character and byte counts: The result panel shows how many characters and how many 7-bit bytes the operation produced, so you can spot empty results and oversized strings immediately.
- • Tolerant of mixed-case hex: Hex codes such as 0x4A, 4A, and 4a all decode to the same value. The calculator accepts either case and the optional 0x prefix so you can paste straight from a hex dump.
When the encoded output is meant for storage rather than display, the data storage converter can translate the byte count into KB, MB, GB, or TB so you can size the payload next to the rest of your data.
Factors That Affect Your Results
Three variables determine what the result looks like, and two limitations tell you when to reach for a different tool.
Selected Base
The same character can appear as 65, 0x41, 101, or 1000001 depending on the base. Switching the base does not change the underlying character; it only changes how the code is displayed or parsed.
Token Separator
Spaces and commas are the most readable for the decimal, hex, and octal bases. Binary with no separator parses correctly because the decoder strips non-bit characters and slices the run into 7-bit chunks, matching the encode step width.
Input Character Set
Letters, digits, punctuation, and the standard whitespace codes (tab, line feed, carriage return) all sit inside the 0-127 range. Anything outside that range (accented letters, emoji, CJK characters) is encoded as a code above 127 and the calculator shows a warning so the out-of-range value is visible.
- • The converter is 7-bit only. It does not handle Unicode code points above 127, extended code pages, or emoji. For full Unicode support, swap to a UTF-8 encoder rather than the ASCII table.
- • Binary output is padded to 7 bits per character to mirror the canonical 7-bit ASCII frame, so 8-bit or parity-aware systems will need to wrap each code with their own framing.
When the same code point needs to show up in a different base (for example, comparing a binary 01000001 to its hex form), the change of base calculator walks the same base-conversion logic step by step, which is the same idea this calculator applies when you switch from decimal to hex or octal.
According to ANSI INCITS US-ASCII standard, the table assigns decimal 0-31 and 127 to control characters, 32 to space, and 48-57 to digits, with the letters interleaved on either side.
Frequently Asked Questions
Q: What does the ASCII converter do?
A: It encodes a text string into ASCII codes in decimal, hex, octal, or binary, and decodes a list of ASCII codes back into text. The same calculator handles both directions and shares the same base and separator settings.
Q: How do you convert text to ASCII codes?
A: Switch the calculator to Encode mode, type or paste the text into the Text Input field, pick a base, and read the matching code list. Each character is converted individually so the result is the same length as the input.
Q: What is the ASCII code for a space?
A: A space is ASCII decimal 32, which is hex 0x20, octal 40, and binary 0100000. Most text editors and hex dumps display spaces using these values, especially when the space separates visible characters.
Q: Can this converter handle binary or hex input?
A: Yes. Switch to Decode mode, paste the binary or hex tokens into the ASCII Code Input field, set the matching base, and the calculator returns the original text. Both upper- and lower-case hex digits are accepted.
Q: What is the difference between ASCII and Unicode?
A: ASCII defines 128 code points (0-127) for English text and basic control codes. Unicode extends that table to tens of thousands of code points so the same system can represent accented letters, non-Latin scripts, and emoji. This calculator only covers the ASCII range.
Q: Are there characters the ASCII converter cannot encode?
A: Yes. Accented letters, CJK characters, emoji, and other characters outside 0-127 are outside the 7-bit ASCII table. The calculator surfaces a warning when it encounters them, but it cannot represent them with a single 7-bit code.