ASCII Converter
Convert text to ASCII codes and vice versa. View decimal, hexadecimal, binary, and octal values.
Enter Text
Result
Character Details
| Char | Decimal | Hex | Binary | Octal |
|---|---|---|---|---|
| H | 72 | 0x48 | 01001000 | 110 |
| e | 101 | 0x65 | 01100101 | 145 |
| l | 108 | 0x6C | 01101100 | 154 |
| l | 108 | 0x6C | 01101100 | 154 |
| o | 111 | 0x6F | 01101111 | 157 |
| Space | 32 | 0x20 | 00100000 | 40 |
| W | 87 | 0x57 | 01010111 | 127 |
| o | 111 | 0x6F | 01101111 | 157 |
| r | 114 | 0x72 | 01110010 | 162 |
| l | 108 | 0x6C | 01101100 | 154 |
| d | 100 | 0x64 | 01100100 | 144 |
About ASCII: ASCII (American Standard Code for Information Interchange) uses 7 bits to represent 128 characters including letters, digits, and symbols.
What Is ASCII and Why Does It Matter?
ASCII — the American Standard Code for Information Interchange — is the foundational character encoding standard that underlies virtually all modern computing. Developed in the early 1960s and officially published as ANSI X3.4-1968, ASCII maps each of 128 printable and control characters to a unique integer from 0 to 127. Every time you press a key on your keyboard, every time a web server transmits a page, and every time a program stores a string of text, ASCII (or one of its supersets, like UTF-8) is almost certainly involved.
The original ASCII table covers the full English alphabet (uppercase and lowercase), the digits 0–9, common punctuation marks, and 33 non-printing control characters such as newline (10), carriage return (13), and the null character (0). This compact 7-bit encoding was deliberately constrained so that a single byte — which has 8 bits — could hold one character with a spare bit left over for error detection.
Understanding ASCII codes is valuable in many practical contexts. Programmers use ASCII values when writing parsers, validating input, or working with low-level binary protocols. Security professionals inspect ASCII representations to detect hidden or non-printable characters that might indicate injection attacks. Students learning about data representation benefit from seeing how every letter and symbol ultimately becomes a number inside a computer. Our ASCII converter calculator makes all of these tasks instant: paste any text and immediately see every character's decimal, hexadecimal, binary, and octal code.
Because modern systems commonly extend ASCII into Unicode (which uses the same 0–127 code points for ASCII characters), this converter works correctly for standard ASCII text. Characters beyond code point 127 are handled by their Unicode scalar value, giving you a flexible tool for a wide range of text-to-number conversion tasks.
How ASCII Conversion Works
Converting text to ASCII is fundamentally straightforward: every character in a string has a unique numeric code point, and the converter simply reads each character's code one by one. In JavaScript — the language powering this calculator — that value is retrieved with charCodeAt(0). The resulting decimal number can then be expressed in any number base: decimal (base 10), hexadecimal (base 16), binary (base 2), or octal (base 8).
The text-to-ASCII direction works character by character. The converter splits your input string into an array of individual characters, calls charCodeAt(0) on each to get the decimal code point, and joins the resulting numbers with your chosen separator (space, comma, dash, or none). Simultaneously, it computes each character's hex representation using toString(16) padded to at least two digits, its 8-bit binary string using toString(2) padded to eight digits, and its octal value using toString(8).
The ASCII-to-text direction reverses the process. The calculator splits your sequence of numbers using the selected separator, parses each token as a base-10 integer with parseInt(value, 10), and reconstructs the text character by character using String.fromCharCode(value). The result is the original string — or any string of your choosing if you are constructing text from scratch.
The details table displayed below the result shows all four representations side by side, making it easy to cross-reference formats without any additional calculation. This is particularly useful when debugging binary file formats, reading network packet dumps, or studying how encoding systems relate to one another.
ASCII Conversion Formulas
Where:
- charCodeAt(0)= JavaScript method returning the UTF-16 code unit (0–65535) of a character — identical to the ASCII value for characters 0–127
- Decimal= The base-10 integer ASCII code point (0–127 for standard ASCII)
- Hex= Base-16 representation, uppercase, zero-padded to at least 2 digits (e.g., "41" for A)
- Binary= Base-2 representation, zero-padded to 8 bits (e.g., "01000001" for A)
- Octal= Base-8 representation without padding (e.g., "101" for A)
- String.fromCharCode(n)= Reverse operation: converts a decimal ASCII/Unicode code point back to its character
ASCII Table Quick Reference
The ASCII standard defines 128 code points. The first 32 (0–31) and the final one (127) are control characters not typically displayed as glyphs. The remaining 95 characters are printable. Here is a concise reference for the most commonly used printable ASCII characters:
| Character | Decimal | Hex | Binary | Octal |
|---|---|---|---|---|
| Space | 32 | 20 | 00100000 | 40 |
| 0 | 48 | 30 | 00110000 | 60 |
| 9 | 57 | 39 | 00111001 | 71 |
| A | 65 | 41 | 01000001 | 101 |
| Z | 90 | 5A | 01011010 | 132 |
| a | 97 | 61 | 01100001 | 141 |
| z | 122 | 7A | 01111010 | 172 |
| ! | 33 | 21 | 00100001 | 41 |
| @ | 64 | 40 | 01000000 | 100 |
| ~ | 126 | 7E | 01111110 | 176 |
A key pattern worth noting: uppercase letters start at decimal 65 (A) and run to 90 (Z), while lowercase letters start at 97 (a) and run to 122 (z). The difference between a letter's uppercase and lowercase code is always exactly 32 — the same value as the space character. This regularity makes case conversion trivially fast in low-level programming by simply toggling bit 5 (the 32-bit position).
Decimal, Hex, Binary, and Octal Explained
The ASCII converter displays each character's code in four number bases simultaneously. Understanding the relationship between these bases helps you read technical documentation, debug protocols, and work effectively with data at the byte level.
Decimal (base 10) is the everyday counting system. ASCII decimal values range from 0 to 127. When you see "72" in a decimal column, it simply means the 72nd entry in the ASCII table — the uppercase letter H.
Hexadecimal (base 16) uses digits 0–9 and letters A–F. Each hex digit represents exactly 4 bits, so one byte (8 bits) is always two hex digits. Hex is ubiquitous in programming: memory addresses, color codes (#FF5733), HTML character references, and network packet dumps all use hex. The hex value for H is 0x48 — where "48" in hex equals 4×16 + 8 = 72 in decimal.
Binary (base 2) is the language of hardware. Every ASCII character occupies exactly 8 bits (one byte) when stored in memory. The letter H in binary is 01001000. Reading from right to left: bit positions 3 and 6 are set (values 8 and 64), giving 8 + 64 = 72. Binary representations make bitwise operations, flags, and masks immediately readable.
Octal (base 8) uses digits 0–7 and groups bits in threes rather than fours. Octal was popular on older systems — Unix file permissions are still expressed in octal (e.g., chmod 755). The letter H in octal is 110, because 72 in decimal = 1×64 + 1×8 + 0×1 = 110 in octal. While less common than hex today, octal still appears in C-style escape sequences and Unix tooling.
The ability to switch between these representations instantly is one of the most practical features of a good ASCII text-to-code converter. Whether you are reading a C header file that uses hex constants, a shell script that uses octal permissions, or documentation that uses binary bit masks, you can cross-reference any character code without mental arithmetic.
Practical Use Cases for an ASCII Converter
An online ASCII converter serves a surprisingly wide range of users. Below are the most common real-world scenarios where converting text to ASCII codes — or reversing the process — saves significant time.
Programming and Debugging
When writing parsers, you often need to compare characters against their code points. Knowing that the newline character is decimal 10, that a tab is 9, and that the tilde (~) is 126 lets you write compact, readable conditions. This converter helps you quickly look up any character without consulting a separate ASCII chart.
Data Encoding and Protocol Work
Many binary protocols specify message fields in terms of ASCII byte values. Converting field values to and from ASCII codes lets you construct or validate messages manually. This is especially useful when crafting test payloads for TCP/IP services or working with serial communication protocols.
Security and CTF Challenges
Capture-the-flag competitions frequently hide flags encoded as sequences of decimal or hex ASCII values. Pasting the number sequence into the ASCII-to-text mode of this converter instantly reveals the hidden text. Similarly, security researchers inspect suspicious strings by viewing their byte values to detect non-printable or unexpected characters.
Education and Learning
Computer science students studying data representation, encoding, and number systems use ASCII converters to ground abstract concepts. Seeing that the letter "A" is 65 in decimal, 41 in hex, 01000001 in binary, and 101 in octal makes the relationship between character encoding and binary data tangible.
Encoding Puzzles and Ciphers
Some simple ciphers encode messages as sequences of ASCII values offset by a constant. Using the text-to-ASCII and ASCII-to-text modes together makes encoding and decoding these puzzles straightforward.
Worked Examples
Convert "Hi!" to ASCII Codes
Problem:
Find the decimal, hex, binary, and octal ASCII values for each character in "Hi!"
Solution Steps:
- 1H: charCodeAt(0) = 72 → Decimal 72, Hex 48, Binary 01001000, Octal 110
- 2i: charCodeAt(0) = 105 → Decimal 105, Hex 69, Binary 01101001, Octal 151
- 3!: charCodeAt(0) = 33 → Decimal 33, Hex 21, Binary 00100001, Octal 41
- 4Join with space separator → Output: "72 105 33"
Result:
ASCII codes: 72 105 33 (space-separated). The details table shows all four bases for each character simultaneously.
Decode ASCII Sequence to Text
Problem:
Convert the ASCII decimal sequence "65 66 67" back to readable text.
Solution Steps:
- 1Split input by space separator → ["65", "66", "67"]
- 2Parse each token: parseInt("65", 10) = 65, parseInt("66", 10) = 66, parseInt("67", 10) = 67
- 3String.fromCharCode(65) = "A", String.fromCharCode(66) = "B", String.fromCharCode(67) = "C"
- 4Join all characters → "ABC"
Result:
Decoded text: "ABC". Each decimal ASCII value maps directly back to its corresponding uppercase letter.
Convert "Hello" to All Number Bases
Problem:
Show the full four-base breakdown for the word "Hello".
Solution Steps:
- 1H → Decimal 72, Hex 48, Binary 01001000, Octal 110
- 2e → Decimal 101, Hex 65, Binary 01100101, Octal 145
- 3l → Decimal 108, Hex 6C, Binary 01101100, Octal 154
- 4l → Decimal 108, Hex 6C, Binary 01101100, Octal 154 (same as previous "l")
- 5o → Decimal 111, Hex 6F, Binary 01101111, Octal 157
- 6Space-separated output: "72 101 108 108 111"
Result:
Five characters produce five sets of values. Repeated characters ("l" appears twice) produce identical rows, confirming the deterministic one-to-one mapping.
Use Comma Separator for CSV-Friendly Output
Problem:
Encode "OK" using a comma separator to produce output compatible with CSV format.
Solution Steps:
- 1O → charCodeAt(0) = 79
- 2K → charCodeAt(0) = 75
- 3Join with "," separator → "79,75"
- 4To reverse: switch to ASCII-to-text mode, set separator to comma, enter "79,75" → "OK"
Result:
"79,75" — comma-separated ASCII values for "OK". Switching the separator and mode lets you round-trip any text through ASCII encoding.
Tips & Best Practices
- ✓Use the comma separator when you need ASCII output that can be pasted directly into a spreadsheet or CSV field.
- ✓Remember that uppercase letters A–Z span decimal 65–90 and lowercase a–z span 97–122; the difference between any letter pair is always exactly 32.
- ✓To check for hidden characters in a string, paste it into text-to-ASCII mode and look for unexpected code points outside the 32–126 printable range.
- ✓The hex column is prefixed with "0x" in the table — when pasting into code, include this prefix to signal a hexadecimal literal in most programming languages.
- ✓Binary values are always 8 digits wide (zero-padded); if you see a value with fewer bits, the leading zeros were stripped — pad back to 8 for correct byte representation.
- ✓To decode ASCII art or encoded messages from CTF challenges, switch to ASCII-to-text mode and paste the number sequence, making sure to match the separator used in the encoded string.
- ✓Digits 0–9 have ASCII codes 48–57, so the numeric character "5" is code 53 — not 5. Always distinguish between the character and its numeric value.
- ✓Use the "None" separator carefully; without a delimiter, multi-digit codes like 72 and 101 merge into "72101", which cannot be correctly parsed in reverse.
Frequently Asked Questions
Sources & References
- ASCII – Wikipedia (2024)
- ANSI X3.4-1986: American National Standard for Information Systems — Coded Character Sets — 7-Bit American National Standard Code for Information Interchange (7-Bit ASCII) (1986)
- Unicode Standard – Unicode Consortium (2024)
- RFC 20 – ASCII Format for Network Interchange (IETF) (1969)
Last updated: 2026-06-05
Help us improve!
How would you rate the ASCII Converter?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: Standard Mathematical References
by Various