Text to Hex
Convert characters into hex codes
What Is the Text to Hex Tool?
The Text to Hex tool converts each character in your text into its hexadecimal code value, with options to control the prefix, letter case, and delimiter used in the output. Type or paste your text, set the output format you need, click Convert, and the hex codes appear ready to copy. It is used for encoding strings for programming tasks, inspecting character values in a hex-friendly format, preparing data for systems that require hexadecimal input, and working through exercises that involve base-16 representation of text.
The prefix and case options are the parts that save the most friction, because different languages and contexts expect hex values in different formats and having those options in one place means less cleanup work after the conversion.
How to Use This Tool
- Paste or type your text into the input box above.
- Set your output preferences: choose a Prefix (such as 0x or none), select Letter Case (uppercase or lowercase), and pick a Delimiter (space, comma, or new line) to separate the hex values.
- Click Convert and the tool outputs a hex code for every character in your input, formatted according to your settings.
- Copy the result using the Copy button, or select and copy manually. Use Clear to reset the input.
When Would You Use This?
Converting a string to hex for use in code, a configuration file, or a data format that expects hexadecimal character codes, where you need the output in a specific format with a prefix or particular casing.
Inspecting the hex values of characters in a string when debugging an encoding issue, checking for unexpected characters, or verifying that a specific byte sequence is what you think it is.
Generating hex-encoded output for use in network protocols, file formats, or low-level data processing where text is represented as hex bytes rather than plain characters.
Examples
Basic conversion with space delimiter
Input : Hello
Prefix: None
Case: Uppercase
Delimiter: Space
Output : 48 65 6C 6C 6F
With 0x prefix and lowercase
Input : Hello
Prefix: 0x
Case: Lowercase
Delimiter: Space
Output : 0x48 0x65 0x6c 0x6c 0x6f
Comma-separated output
Input : Test
Prefix: None
Case: Uppercase
Delimiter: Comma
Output : 54,65,73,74
Including a space character
Input : Hi there
Prefix: None
Case: Uppercase
Delimiter: Space
Output : 48 69 20 74 68 65 72 65
(20 is the hex code for a space character)
Frequently Asked Questions
How do I convert text to hexadecimal?
Paste your text into the input box, choose your prefix, case, and delimiter settings, and click Convert. Each character is mapped to its two-digit hex code and the output appears with your chosen formatting.
What is hexadecimal?
Hexadecimal is a base-16 number system that uses the digits 0-9 and the letters A-F. In computing, it is widely used because it maps neatly to binary, with each hex digit representing exactly 4 bits. Two hex digits together represent one byte, which corresponds to one character in ASCII encoding.
What does the 0x prefix mean?
0x is a prefix used in many programming languages to indicate that a number is in hexadecimal format rather than decimal. For example, 0x48 means the hex value 48, which is the letter H. Choosing no prefix produces the raw hex digits without any notation.
Should I use uppercase or lowercase hex?
It depends on your context. Lowercase hex (like 48656c6c6f) is common in web contexts such as color codes and URL encoding. Uppercase (like 48656C6C6F) appears more often in code, protocol specifications, and technical documentation. Both represent the same values.
How do I convert text to hex in Python?
Use the encode and hex methods: "Hello".encode().hex() returns '48656c6c6f'. For formatted output with spaces: ' '.join(format(ord(c), '02x') for c in "Hello"). For a quick conversion without writing code, paste into this tool.
What is the hex code for a space?
A space character in ASCII is decimal 32, which in hexadecimal is 20. If you convert text with spaces, you will see 20 appearing between the word character codes in the output.
What is the hex value for A?
The uppercase letter A in ASCII is decimal 65, which in hex is 41. Lowercase a is decimal 97, which in hex is 61.
Can I convert hex back to text?
Yes. Use the Hex to Text tool, which translates hexadecimal values back into the characters they represent. That is the reverse operation of this one.