EasyUnitConverter.com

Ascii To Hex Converter

Enter the ascii text value to convert to hexadecimal or Hexadecimal to ASCII Text.

10
10
10
16

ASCII Text:

ASCII text characters each have a numeric code that can be expressed in hexadecimal.

Hexadecimal:

Hexadecimal representation of text is used in programming, networking, and data analysis.

How to Convert ASCII Text to Hexadecimal — Formula:

For each character: hex = charCode.toString(16).padStart(2, "0").toUpperCase().

Example: "Hello" → 48 65 6C 6C 6F.

Technical Details:

Common ASCII hex values: A=41, Z=5A, a=61, z=7A, 0=30, 9=39, space=20, newline=0A. This encoding is used in hex editors, network protocol analysis, and debugging.

Ascii To Hex Converter:

Convert text to hexadecimal byte values. Each character becomes a 2-digit hex code.

How to Convert ASCII Text to Hexadecimal

  1. Take the ascii text value
  2. Apply the conversion formula
  3. Get the hexadecimal result

ASCII Text to Hex, Binary Conversion Table

ASCII CharacterHexadecimalBinary
NUL0000000000
SOH0100000001
STX0200000010
ETX0300000011
EOT0400000100
ENQ0500000101
ACK0600000110
BEL0700000111
BS0800001000
HT0900001001
LF0A00001010
VT0B00001011
FF0C00001100
CR0D00001101
SO0E00001110
SI0F00001111
DLE1000010000
DC11100010001
DC21200010010
DC31300010011
DC41400010100
NAK1500010101
SYN1600010110
ETB1700010111
CAN1800011000
EM1900011001
SUB1A00011010
ESC1B00011011
FS1C00011100
GS1D00011101
RS1E00011110
US1F00011111
Space2000100000
!2100100001
"2200100010
#2300100011
$2400100100
%2500100101
&2600100110
'2700100111
(2800101000
)2900101001
*2A00101010
+2B00101011
,2C00101100
-2D00101101
.2E00101110
/2F00101111
03000110000
13100110001
23200110010
33300110011
43400110100
53500110101
63600110110
73700110111
83800111000
93900111001
:3A00111010
;3B00111011
<3C00111100
=3D00111101
>3E00111110
?3F00111111
@4001000000
A4101000001
B4201000010
C4301000011
D4401000100
E4501000101
F4601000110
G4701000111
H4801001000
I4901001001
J4A01001010
K4B01001011
L4C01001100
M4D01001101
N4E01001110
O4F01001111
P5001010000
Q5101010001
R5201010010
S5301010011
T5401010100
U5501010101
V5601010110
W5701010111
X5801011000
Y5901011001
Z5A01011010
[5B01011011
\5C01011100
]5D01011101
^5E01011110
_5F01011111
`6001100000
a6101100001
b6201100010
c6301100011
d6401100100
e6501100101
f6601100110
g6701100111
h6801101000
i6901101001
j6A01101010
k6B01101011
l6C01101100
m6D01101101
n6E01101110
o6F01101111
p7001110000
q7101110001
r7201110010
s7301110011
t7401110100
u7501110101
v7601110110
w7701110111
x7801111000
y7901111001
z7A01111010
{7B01111011
|7C01111100
}7D01111101
~7E01111110
DEL7F01111111

Frequently Asked Questions

How do I convert ASCII Text to Hexadecimal?

For each character: hex = charCode.toString(16).padStart(2, "0").toUpperCase().

What is the ASCII Text number system?

ASCII text characters each have a numeric code that can be expressed in hexadecimal.

What is the Hexadecimal number system?

Hexadecimal representation of text is used in programming, networking, and data analysis.

Where is ASCII Text to Hexadecimal conversion used?

Common ASCII hex values: A=41, Z=5A, a=61, z=7A, 0=30, 9=39, space=20, newline=0A. This encoding is used in hex editors, network protocol analysis, and debugging.

Can I convert large ascii text numbers?

Yes. This converter handles numbers of any practical size. For very large numbers, the conversion is performed using arbitrary-precision arithmetic to ensure accuracy.

How to Convert ASCII to Hexadecimal (Characters to Hex Codes)

Converting ASCII characters to hex is used when constructing network packets, writing binary protocols, creating hex dumps, and working with URL encoding. Each ASCII character maps to a 2-digit hex code between 0x00 and 0x7F. This is the reverse of reading a hex dump — you are creating one.

  1. Look up each character's ASCII decimal value.
  2. Convert the decimal value to a 2-digit hexadecimal number.
  3. For quick mental conversion: high nibble = value ÷ 16, low nibble = value mod 16.
  4. Concatenate all hex pairs (optionally space-separated for readability).
  5. Example: "OK" → 79, 75 → 4F 4B.
💡 Tip: Learn hex ranges: uppercase letters are 41-5A, lowercase are 61-7A, digits are 30-39. The difference between upper and lowercase is always 0x20 (32). Adding 0x20 to any uppercase letter gives its lowercase equivalent.

ASCII to Hex: Common Characters

Characters you will frequently need to convert to hex for protocol work:

InputOutput
Space0x20
!0x21
#0x23
%0x25
/0x2F
00x30
:0x3A
?0x3F
A0x41
a0x61
{0x7B
}0x7D

Solved Examples: ASCII to Hex

Question 1: Encode the HTTP method "POST" in hex for a raw socket transmission.

Solution:

P = 80 = 0x50

O = 79 = 0x4F

S = 83 = 0x53

T = 84 = 0x54

Answer: "POST" = 50 4F 53 54 in hex — these are the first 4 bytes of an HTTP POST request.

Question 2: URL-encode the string "a b" (with a space) using hex.

Solution:

a = 0x61 (no encoding needed, alphanumeric)

space = 0x20 → %20

b = 0x62 (no encoding needed)

Answer: "a b" URL-encodes to "a%20b" — the space character becomes its hex representation preceded by %.

Question 3: Generate the hex for a JSON null terminator: {"x":null}\0

Solution:

{=7B, "=22, x=78, "=22, :=3A

n=6E, u=75, l=6C, l=6C

}=7D, \0=00

Answer: Full hex: 7B 22 78 22 3A 6E 75 6C 6C 7D 00 — the trailing 00 is the NULL terminator.

Practice: ASCII to Hex

Try solving these on your own to test your understanding:

  1. Convert "GET" to hex. (Answer: 47 45 54)
  2. What is the hex for the @ symbol? (Answer: 0x40)
  3. Convert "127.0.0.1" to hex. (Answer: 31 32 37 2E 30 2E 30 2E 31)
  4. What is the hex for a newline \n? (Answer: 0x0A)
  5. Convert "true" to hex. (Answer: 74 72 75 65)
  6. What hex value represents the colon character? (Answer: 0x3A)

Building Network Packets with Hex

When crafting raw network packets (using tools like Scapy, netcat, or writing socket code), you specify data in hex. An HTTP request "GET / HTTP/1.1\r\n" becomes 47 45 54 20 2F 20 48 54 54 50 2F 31 2E 31 0D 0A. Each ASCII character is one hex byte. Understanding this mapping lets you read Wireshark captures, construct protocol payloads, and debug network issues at the byte level.

Hex Escapes in Programming Languages

Most languages support hex escapes in strings: C/C++ uses \x41 for "A", Python uses \x41 or bytes.fromhex("41"), JavaScript uses \x41 or String.fromCharCode(0x41). When dealing with binary protocols or non-printable characters, hex escapes are essential: \x00 (NULL), \x0A (newline), \x1B (ESC for terminal colors). These are all ASCII-to-hex conversions embedded directly in source code.

Key Takeaways

  • Each ASCII character = one 2-digit hex code (0x00 to 0x7F).
  • Uppercase letters: 0x41-0x5A; lowercase: 0x61-0x7A; digits: 0x30-0x39.
  • Add 0x20 to uppercase hex to get lowercase (A=41, a=61).
  • URL encoding uses %XX format where XX is the ASCII hex code.
  • Programming languages support \xNN for hex character escapes.
  • Network debugging requires reading and writing ASCII as hex bytes.

Related Number System Converters: