Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages

Free tool · Developer tools

ASCII to hex converter

Type or paste text and get its hex bytes at once. "Hello, World!" becomes 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21, which is 13 bytes, and a table shows the decimal, hex, octal and binary code of every character.

  • Free
  • No sign-up
  • Runs in your browser

By Maaz Zindani · Updated

Letters, digits, symbols, spaces and line breaks all work. A line break is the byte 0a.
Letters in the hex
Hex

13 bytesfrom 13 characters

48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21
  • ASCII only
  • Spaces: 48 65 6c
Printable characters
12
Spaces
1
Control characters (line breaks, tabs)
0
Bytes in total
13
Character by character
CharacterDecimalHexOctalBinaryKind
H724811001001000Printable character
e1016514501100101Printable character
l1086c15401101100Printable character
l1086c15401101100Printable character
o1116f15701101111Printable character
,442c05400101100Printable character
space322004000100000Space
W875712701010111Printable character
o1116f15701101111Printable character
r1147216201110010Printable character
l1086c15401101100Printable character
d1006414401100100Printable character
!332104100100001Printable character

How to use the ASCII to Hex Converter

  1. Type or paste your text into Your text.
  2. Pick an Output style: spaces, no separator, a 0x prefix, \x escapes or a C array.
  3. Choose what happens to Characters beyond ASCII: write their UTF-8 bytes or refuse them, and tick capitals if you want 4A in place of 4a.
  4. Press Copy hex and read the character table to check each code.

How do I convert ASCII text to hex?

Every ASCII character has a number from 0 to 127, and hex writes that number in base 16. Take the letter H. Its code is 72, and 72 = 4 × 16 + 8, so the hex digits are 4 and 8: 48. The letter W is 87 = 5 × 16 + 7, which is 57, and a lowercase o is 111 = 6 × 16 + 15, which is 6f, because 15 is written f. Do that for each character and join the pairs.

For "Hello, World!" the result is 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21. The text has 13 characters and each is one byte, so there are 13 hex pairs. The comma is 2c, the space is 20 and the exclamation mark is 21. The tool does the same sum for any length of text, and the table underneath shows the first five characters like this.

The first five characters of the example
CharacterDecimalHexOctalBinary
H724811001001000
e1016514501100101
l1086c15401101100
l1086c15401101100
o1116f15701101111

What are ASCII codes and where does the hex come from?

ASCII is a 7-bit code of 128 positions, defined for data interchange in RFC 20. Codes 0 to 31 and 127 are control characters with names such as LF for line feed and ESC for escape. Code 32 is the space, and codes 33 to 126 are the printable letters, digits and symbols. A byte has 8 bits, so the top bit of an ASCII byte is always 0 and the hex of an ASCII byte never goes above 7f.

The layout makes the hex easy to read. Digits 0 to 9 are 30 to 39. Capital letters run from 41 to 5a. Lowercase letters run from 61 to 7a, exactly 20 hex higher than the capitals, so A is 41 and a is 61. The table lists landmark characters and the control characters people meet most often.

Landmark ASCII codes
CharacterDecimalHexBinary
0483000110000
9573900111001
A654101000001
Z905a01011010
a976101100001
z1227a01111010
~1267e01111110

Control characters are the invisible ones. The tool counts them and names them in the character table.

What happens with accents, the euro sign and emoji?

They are not ASCII, because their numbers are above 127. With "Write their UTF-8 bytes" selected, each such character becomes two to four bytes, the way most files and web pages store it. "Café" gives 43 61 66 c3 a9: the first three letters are single ASCII bytes and the é is the two bytes c3 a9. The euro sign gives e2 82 ac, and the grinning face emoji gives f0 9f 98 80, four bytes.

Choose "Refuse them" if you need strict ASCII. The tool then names the first character it cannot encode and its position, which helps when a protocol or a legacy file accepts only 7-bit text. Other encodings can give a different byte for é, so match the encoding your target uses.

Which output style should I choose?

The five styles carry the same bytes. For "Hi" they read 48 69, 4869, 0x48 0x69, \x48\x69 and {0x48, 0x69}. Spaced pairs suit reading and hex editors, the unbroken run suits URLs and compact notes, the 0x form and the C array paste into code, and the backslash form drops into string literals in many languages.

Line breaks count as characters. A line feed is 0a and a carriage return is 0d, so text copied from a Windows file may contain both, as in 61 0d 0a 62 for "a", a Windows line break and "b". If your hex ends in an unexpected 0a, a trailing new line is the reason.

Everything is converted in your browser. Nothing you type is sent anywhere.

Common control characters and the space
NameDecimalHexKind
HT909Control character (HT)
LF100aControl character (LF)
CR130dControl character (CR)
ESC271bControl character (ESC)
space3220Space
DEL1277fControl character (DEL)

Use it with

Questions

How do I convert ASCII to hex by hand?

Look up the decimal code of each character, divide it by 16, and write the quotient and the remainder as hex digits. H is 72, which is 4 and 8, so 48.

What is the hex of "Hello, World!"?

48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21.

Why is lowercase a 61 and uppercase A 41?

Lowercase letters sit exactly 32 places after the capitals, which is 20 in hex. Adding 20 to the hex of a capital gives the lowercase letter.

What does a non-ASCII character like é become?

With UTF-8 selected it becomes two bytes, c3 a9. In strict ASCII mode the tool refuses it, because it has no ASCII code.

Can I get capital hex letters?

Yes, tick the capitals box. The text H stays 48, and a j changes from 6a to 6A.

Is my text uploaded?

No. The conversion runs in your browser and the text is gone when you close the tab.

The tool's results are computed in your browser by the code on this page, using the sources listed above; the explanations are checked against the tool's own output.