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
13 bytesfrom 13 characters
- ASCII only
- Spaces: 48 65 6c
- Printable characters
- 12
- Spaces
- 1
- Control characters (line breaks, tabs)
- 0
- Bytes in total
- 13
| Character | Decimal | Hex | Octal | Binary | Kind |
|---|---|---|---|---|---|
| H | 72 | 48 | 110 | 01001000 | Printable character |
| e | 101 | 65 | 145 | 01100101 | Printable character |
| l | 108 | 6c | 154 | 01101100 | Printable character |
| l | 108 | 6c | 154 | 01101100 | Printable character |
| o | 111 | 6f | 157 | 01101111 | Printable character |
| , | 44 | 2c | 054 | 00101100 | Printable character |
| space | 32 | 20 | 040 | 00100000 | Space |
| W | 87 | 57 | 127 | 01010111 | Printable character |
| o | 111 | 6f | 157 | 01101111 | Printable character |
| r | 114 | 72 | 162 | 01110010 | Printable character |
| l | 108 | 6c | 154 | 01101100 | Printable character |
| d | 100 | 64 | 144 | 01100100 | Printable character |
| ! | 33 | 21 | 041 | 00100001 | Printable character |
How to use the ASCII to Hex Converter
- Type or paste your text into Your text.
- Pick an Output style: spaces, no separator, a 0x prefix, \x escapes or a C array.
- 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.
- 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.
| Character | Decimal | Hex | Octal | Binary |
|---|---|---|---|---|
| H | 72 | 48 | 110 | 01001000 |
| e | 101 | 65 | 145 | 01100101 |
| l | 108 | 6c | 154 | 01101100 |
| l | 108 | 6c | 154 | 01101100 |
| o | 111 | 6f | 157 | 01101111 |
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.
| Character | Decimal | Hex | Binary |
|---|---|---|---|
| 0 | 48 | 30 | 00110000 |
| 9 | 57 | 39 | 00111001 |
| A | 65 | 41 | 01000001 |
| Z | 90 | 5a | 01011010 |
| a | 97 | 61 | 01100001 |
| z | 122 | 7a | 01111010 |
| ~ | 126 | 7e | 01111110 |
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.
| Name | Decimal | Hex | Kind |
|---|---|---|---|
| HT | 9 | 09 | Control character (HT) |
| LF | 10 | 0a | Control character (LF) |
| CR | 13 | 0d | Control character (CR) |
| ESC | 27 | 1b | Control character (ESC) |
| space | 32 | 20 | Space |
| DEL | 127 | 7f | Control character (DEL) |
Use it with
- Base64 Encoder Decoder: encode or decode Base64.
- Number Base Converter: binary, octal, decimal, hex.
- URL Encoder Decoder: percent-encode or decode URLs.
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.
Sources
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.