Solved.tools โ€” Free Online Calculators & Tools

We use cookies for analytics and advertising. Learn more about our cookie policy

ASCII to Hex Converter

Last updated: 12 August 2026

Reviewed by Gavin ยท Research and drafting assisted by AI

Was this helpful?


ASCII to Hex Converter

Intro

ASCII to hexadecimal conversion gives every familiar text character a compact byte representation. This free bidirectional converter turns letters, digits, punctuation, spaces, and line breaks into hexadecimal, then decodes hexadecimal bytes back into readable ASCII. Hex is useful because it exposes the numeric value behind a character without the ambiguity of invisible whitespace or control characters. The tool works in the browser, accepts uppercase or lowercase hex digits, and permits spaces between byte pairs when decoding. It is an encoding and inspection utility, not encryption; the output can be reversed by anyone who understands the format.

How to Use

Choose ASCII โ†’ Hex to encode text, type or paste into the input box, and read the result below. Choose Hex โ†’ ASCII to decode, then enter a continuous hex string or byte pairs separated by spaces. Conversion updates as you type and the button provides an explicit second way to run it. Empty input produces an empty result. An odd number of hex digits is rejected because a complete byte needs two digits.

The Formula

ASCII assigns each standard character a numeric code point from 0 through 127, a 7-bit value. For byte-oriented storage, that value is padded to 8 bits, which is one byte. A byte contains two hexadecimal nibbles, and each nibble represents 4 bits, so one byte is written with exactly two hex characters. To encode, look up the ASCII code point and express it in base 16, padding a leading zero when needed: space is decimal 32 and hexadecimal 20, while the capital letter A is decimal 65 and hexadecimal 41. To decode, split the input into two-digit byte values, interpret each pair as base 16, and map the resulting value back to its ASCII character. This converter ignores whitespace between pairs but does not silently invent a missing nibble.

Worked Examples

Example 1: Hello

The text Hello contains five characters. H is 48, e is 65, l is 6c, l is 6c, and o is 6f in hexadecimal. Joining those byte values without separators gives 48656c6c6f. The same value may be written 48 65 6c 6c 6f for readability; the decoder treats both forms identically.

Example 2: ABC123

Capital letters and digits retain their own ASCII ranges. A, B, and C become 41, 42, and 43. The digits 1, 2, and 3 become 31, 32, and 33, because digit characters are encoded as text values rather than numeric quantities. Therefore ABC123 becomes 414243313233.

Example 3: The quick brown fox

Spaces matter and are encoded as byte 20. The phrase The quick brown fox becomes 54686520717569636b2062726f776e20666f78. Notice the 20 after The, quick, and brown. Removing those pairs would concatenate words during decoding.

Example 4: punctuation and line breaks

An exclamation mark is 21, and a newline is commonly represented by byte 0a. Thus Hi! becomes 486921. When inspecting multiline text, preserve each 0a pair if you want decoding to recreate the line break exactly.

Where It Shows Up

Hexadecimal appears in URL and programming-language escape notation, debug logs, packet and protocol inspection, and hex dumps of files. Tools such as xxd display file bytes in hexadecimal beside an ASCII preview, helping developers compare readable text with raw storage. Low-level programmers use hex when examining memory, character encodings, and serialized fields. It is also common when checking delimiters or invisible control characters in a string. URL percent encoding is related but not identical: a percent escape includes a % marker and generally represents bytes in a chosen encoding, often UTF-8. Use this converter for ASCII byte inspection, and use a UTF-8-aware encoder for international text.

Common Mistakes

An odd-length hex string cannot describe whole bytes, so this tool reports hex string must have even length rather than guessing. Hex letters are case-insensitive, but characters outside 0 to 9 and A-F are invalid. Do not confuse the character 1 with the numeric byte value one: ASCII digit 1 is 31. Spaces between pairs are formatting and are ignored by the decoder; spaces within a pair are not a meaningful byte. ASCII is limited to 7-bit characters. Accented letters, emoji, and many symbols require Unicode encoding, normally UTF-8, which may use multiple bytes. Finally, byte order matters in multi-byte numeric values, but ordinary ASCII text is decoded one byte at a time; do not reverse a text hex string because a binary integer example used a particular endianness.

Frequently Asked Questions

What is ASCII to hex conversion?

It is the process of replacing each ASCII character with its numeric code written in base 16. Every standard character becomes one two-digit hexadecimal byte, so the result is compact and easy to inspect.

Is hexadecimal the same as encryption?

No. Hexadecimal is a representation or encoding. It does not hide information or require a secret key. Anyone can convert the bytes back to the original ASCII text.

Does the converter accept spaces in hex input?

Yes. Whitespace between complete byte pairs is removed before decoding, so 48 65 6c 6c 6f and 48656c6c6f both decode to Hello.

Why must hex input have an even number of digits?

One byte is represented by two hexadecimal digits. An odd final digit would be only half a byte, so there is no unambiguous character value to decode.

Are uppercase and lowercase hex equivalent?

Yes. Hexadecimal digits A through F have the same values in either case. For example, 48656C6C6F decodes exactly like 48656c6c6f.

Can ASCII represent emoji or accented letters?

No. ASCII covers code points 0 through 127. Characters outside that range need a Unicode encoding such as UTF-8, where one character can occupy multiple bytes. Use a UTF-8 converter when byte-accurate international text is required.

What does 20 represent in a hex string?

20 is the hexadecimal ASCII code for a regular space. It is why encoded sentences contain two-digit 20 pairs between words.

Can I use this output as a password or security token?

Hex output should not be treated as protection. It is reversible and provides no confidentiality. For security-sensitive values, use a suitable password manager, encryption scheme, or cryptographic hash for the specific purpose.

References

For authoritative character assignments, consult the ANSI X3.4 ASCII specification and Unicode documentation for the distinction between ASCII and Unicode. Operating-system tools such as xxd and hexdump are practical references for viewing raw bytes alongside text.

More Tools

Explore our text-to-binary converter for another representation of character bytes, or use the Base64 converter when a transport-safe text encoding is more convenient.

Disclaimer

This converter is provided for general educational and utility purposes. Verify encoding assumptions, character sets, and byte order against the specification of the system or protocol you are working with.

Worked Examples and Edge Cases

Working with hexadecimal bytes is a routine part of low-level inspection, debugging, and data interchange. The examples below cover cases that frequently trip up a first-time user: trailing whitespace, padding, mixed-case digits, and embedded punctuation. Each scenario shows the input, the value the converter produces, and a short note about why the answer is what it is.

Example 5: trailing newline. A common source of surprise is a trailing newline. The string Hello\n (where \n is the newline byte 0a) encodes as 48656c6c6f0a. Many editors automatically append a newline to the end of a file, so when you copy text out of a file and into this converter, the result may be one byte longer than you expect. The extra 0a is the line terminator, not a bug in the converter.

Example 6: padded single-digit nibbles. When encoding the ASCII code point for the digit 0, the value is decimal 48 and hexadecimal 30. The leading 3 is not optional. If you ever see 030 in a hex string, the extra zero is a mistake and should be removed, because two hex digits always represent one byte.

Example 7: mixed-case hex and embedded spaces. The decoder accepts hex strings in either case and tolerates space separators anywhere between complete byte pairs. The inputs 48 65 6C 6C 6F, 48-65-6c-6c-6f, and 48656c6c6f all decode to Hello. Other separators (dashes, semicolons, commas) are not stripped and will cause decode errors.

Example 8: control characters and tabs. A tab character is ASCII code point 9, hex 09. A carriage return is code point 13, hex 0d. The line-ending sequence CRLF used on older Windows files is 0d0a. If you decode a string that contains 09 and expect a tab, you can verify by re-encoding your output and comparing.

Example 9: long strings and visual grouping. A 200-character ASCII string encodes to 400 hex digits. For readability, group the output in pairs of bytes (4 hex digits) when sharing or pasting into a debugging session. Many editors and inspection tools also support ASCII-art hex dumps that line up the hex representation alongside the decoded characters.

Example 10: empty input and short inputs. The empty string encodes to the empty string. A single character A encodes to 41. The decoder accepts the single-byte input 41 and returns A. There is no minimum length for either direction.

Example 11: frontmatter and message headers. Email systems, HTTP headers, and many log formats prefix a header with the byte length in hex. A Content-Length header such as 0a may indicate that the message body is 10 bytes long. The hex-to-text direction of this converter is the right tool for inspecting exactly which bytes a header is describing.

Example 12: clipboard and copy-paste quirks. Depending on the source application, copying a hex string may append a trailing newline, an extra space, or a non-breaking space. If the decoder refuses to accept a string and you suspect a stray invisible character, paste the string into a plain-text editor first and re-copy.

Example 13: leading zeroes that are mathematically redundant. The encoded form of a single digit 0 is 30, not 3. The padded form is required because each byte occupies exactly two hex digits. If you want to compress a long run of zeroes, consider a different encoding such as base64, which uses fewer characters for the same byte content.

Example 14: very large strings. The converter uses standard JavaScript string operations, which handle arbitrary length input. For strings over a few hundred kilobytes, browser performance may slow because the entire string is held in memory while the conversion is performed. For very large files, a dedicated hex dump tool is more efficient.

Example 15: what the converter does NOT do. This tool does not encode to or from Unicode encodings such as UTF-8 or UTF-16. It does not compress, encrypt, or hash its input. It does not validate that bytes represent printable characters; it simply performs the byte-to-hex or hex-to-byte mapping. When you need those features, use a Unicode-aware encoder or a hash function such as SHA-256.

Practical Tips

  • Always cross-check the round trip. If you encode a string and then decode the result, you should get the original input back. If you do not, the most likely culprit is whitespace, mixed encoding, or a stray visible character that you did not intend to include.
  • Use hex for byte-level inspection, not for storage. Modern systems store text in Unicode for human-readable content. Hex is appropriate for short technical inspections, binary protocols, and reverse engineering; for long-term storage, prefer a Unicode-aware format.
  • Choose the right tool for the job. Hex is great when you need to see exactly which bytes are in a file. Base64 is more compact when you need to embed binary data in text-only systems. URL encoding is appropriate when you need to include special characters in a URL. Choose the representation that matches the medium.
  • Beware of locale and clipboard conversion. Some systems automatically convert certain characters when copying to the clipboard. If the round-trip fails, paste into a plain-text editor first.
  • Count bytes, not characters. A 10-character ASCII string is 10 bytes; a 10-character Unicode string may be 10, 20, or 30 bytes depending on the characters chosen.