String to Hex

Konvertieren Sie jede Textzeichenfolge sofort in ihre hexadezimale Darstellung. Unser kostenloses Online-Tool unterstützt alle Zeichenkodierungen und bietet mehrere Ausgabeformate.

What is String to Hex Converter?

A String to Hex converter encodes text as hexadecimal byte values. This String to Hexadecimal Converter maps each input character to one or more bytes under a selected character Encoding, and every byte appears as two Base16 digits from 00 to ff. The Hex Converter can generate a lowercase or uppercase Hex String, add spaces, and add a 0x prefix.

Use the converter for text to hex conversion, Unicode inspection, binary data representation, byte array formatting, and hex string decoding. Conversion runs in the browser, so the input does not need to leave the device.

tools.stringToHex.title
Live byte map

See how each character becomes UTF-8 bytes and formatted hex.

0 bytes
TextUTF-8 bytesHex

Enter text above to animate the conversion.

tools.hexToString.title

About string to hex conversion tool

The string to hexadecimal converter reads the input with Unicode Transformation Format 8-bit (UTF-8) encoding and displays the resulting bytes in hexadecimal. Hexadecimal uses 16 symbols: 0–9 and a–f. One hex digit represents a four-bit nibble, and two hex digits represent one eight-bit byte.

Hex encoding is a form of Number Conversion for byte values. Decoding reverses the displayed Hex String to bytes before the selected character encoding turns those bytes back into text.

ASCII characters use one UTF-8 byte. Many accented characters, symbols, and non-Latin scripts use two to four bytes. For example, A becomes 41, while becomes e2 82 ac.

How to use the String to Hex Converter?

  1. Type or paste text into the Input String field.
  2. Select spaces, a 0x prefix, or uppercase output.
  3. Read the hexadecimal output as the converter updates.
  4. Choose Copy to place the hex string on the clipboard.

Enter the text to encode to hex

Enter Hello to encode the text to hex. UTF-8 produces 48 65 6c 6c 6f. Remove spaces to get 48656c6c6f, or enable uppercase and prefixes to get 0x48 0x65 0x6C 0x6C 0x6F.

How to use ASCII Text to Hex converter?

To use an ASCII Text to Hex converter, enter ASCII text and read each character as a two-digit hex byte. The text ABC converts to 41 42 43. ASCII defines values from decimal 0 to 127, so every ASCII character fits in one byte.

Text to Hex

Text to Hex converts readable characters into a hex representation of the encoded bytes. Hex is a display format, not encryption and not a hash. A Hex to Text operation can recover the original text when the correct encoding and complete byte sequence are available.

What can you do with String to Hex Online?

A String to Hex online tool supports six common tasks: generate hex from a string, inspect UTF-8 bytes, create hexadecimal escape sequences, format byte arrays, validate hex strings, and decode hex back to text. The output can be pasted into source code, a hex editor, a protocol test, or an online converter such as Code Beautify or Rapid Tables for comparison.

Example of Hex to Text

Enter 53 74 72 69 6e 67 in the Input Hex field. The Hex to Text result is String. The decoder ignores spaces and 0x prefixes, then reads each pair of hexadecimal digits as one byte.

Practical Applications and Use Cases

Development

Inspect byte values, build test fixtures, format byte arrays, and debug data in Python, Java, JavaScript, C++, PHP, Ruby, Go, Rust, Swift, Kotlin, and PowerShell.

Data analysis

Read packet captures, MAC addresses, memory dumps, hexadecimal escape sequences, and raw bytes in tools such as HxD, CyberChef, and Notepad++.

Testing

Prepare values for NI TestStand, LabVIEW, Campbell Scientific equipment, APIs, serial devices, and User Forum examples.

Encoding checks

Compare ASCII and Unicode output, validate UTF-8 byte order, and distinguish Base16 data from Base64, MD5, or SHA-1 text.

A hex color code such as #6366f1 uses hexadecimal channel values, but it is not text encoding. MAC addresses use hex bytes for hardware identifiers. MD5 and Secure Hash Algorithm 1 (SHA-1) commonly display digests as hex, but hashes cannot be decoded back to their source text.

How to Convert Text to Hex

To convert text to hex in code, encode the string into bytes and format every byte as two hexadecimal digits. UTF-8 is the standard choice for multilingual text.

Python"Hello".encode("utf-8").hex()
JavaScriptArray.from(new TextEncoder().encode("Hello"), b => b.toString(16).padStart(2, "0")).join("")
JavaHexFormat.of().formatHex("Hello".getBytes(StandardCharsets.UTF_8))
C++format each unsigned char with std::hex and std::setw(2)
PHPbin2hex("Hello")
Ruby"Hello".unpack1("H*")
Gohex.EncodeToString([]byte("Hello"))
Rusthex::encode("Hello")
Swift"Hello".utf8.map { String(format: "%02x", $0) }.joined()
Kotlin"Hello".toByteArray().joinToString("") { "%02x".format(it) }
PowerShell[Convert]::ToHexString([Text.Encoding]::UTF8.GetBytes("Hello"))

Python provides bytes.hex() and the binascii module. Other platforms expose equivalent encoding and formatting functions. C#, Bash, Dart, Arduino, Excel, Linux, LabVIEW, and MATLAB follow the same two-step process: create bytes, then format bytes in Base16.

FAQs on String to Hex

How to convert ASCII Text to Hex?

Convert ASCII text to hex by replacing each ASCII character with its two-digit hexadecimal value. For example, Cat becomes 43 61 74.

Convert ASCII String to Hex

Read the ASCII code for each character, convert the decimal code to Base16, and pad single-digit values with a leading zero. The ASCII string A0 contains decimal values 65 and 48, which become 41 30.

How to convert English to Hex code?

Convert English to hex code by encoding the English text as ASCII or UTF-8 and formatting each byte in Base16. Plain English letters produce the same bytes in ASCII and UTF-8.

How to convert 'A' character to hex?

The uppercase A character converts to hexadecimal 41. Its ASCII and Unicode code point is decimal 65.

How to convert '0' character to hex?

The character 0 converts to hexadecimal 30. The text character is different from the numeric value zero, which is 00 when stored as one byte.

Explore all conversion tools

Choose a calculator based on the input and output format. Every tool requests the value required by its title and returns the matching conversion result.

Unicode textString to Hex ConverterUTF-8 hexadecimal bytesOpen converter hexadecimal byte pairsHex to String ConverterUTF-8 stringOpen converter plain textText to Hex ConverterUTF-8 hexadecimalOpen converter hexadecimal bytesHex to Text Converterreadable textOpen converter ASCII charactersASCII to Hex Convertertwo-digit hex valuesOpen converter hex values from 00 to 7fHex to ASCII ConverterASCII charactersOpen converter Unicode text encoded as UTF-8UTF-8 to Hex ConverterUTF-8 hexadecimal bytesOpen converter UTF-8 hexadecimal bytesHex to UTF-8 ConverterUnicode textOpen converter binary bitsBinary to Hex Converterhexadecimal digitsOpen converter hexadecimal digitsHex to Binary Converterfour bits per hex digitOpen converter base-10 integerDecimal to Hex ConverterBase16 integerOpen converter Base16 integerHex to Decimal Converterbase-10 integerOpen converter Base64 textBase64 to Hex Converterhexadecimal bytesOpen converter hexadecimal bytesHex to Base64 ConverterBase64 textOpen converter plain or percent-encoded textURL Encode/DecodeURL-safe or decoded textOpen converter UTF-8 textText to Binary Convertereight-bit binary bytesOpen converter eight-bit binary bytesBinary to Text ConverterUTF-8 textOpen converter Unicode stringString to Binary ConverterUTF-8 binary bytesOpen converter text charactersString to ASCII Converterdecimal character valuesOpen converter decimal, 0x-prefixed hex, or binaryHexadecimal Convertermultiple number systemsOpen converter

Frequently Asked Questions (FAQ)

Why are there so many encoding options? Which one should I use?

Character encodings map text to bytes in different ways. Use UTF-8 for web content, APIs, files, and multilingual text. Use ASCII only when the data is limited to its 128-character set. Use another encoding only when an existing system requires it.

What's the difference between "Hex" and "Base64" in the encoding list?

Hex uses two characters per byte and the symbols 0–9 and a–f. Base64 uses a 64-character alphabet and usually needs fewer display characters. Both represent bytes and neither encrypts data.

Why does the same text produce different hex results under different encodings?

The same text produces different hex results when encodings assign different byte sequences to a character. ASCII-compatible letters often match, while accented letters and non-Latin scripts can differ.

Where does the conversion run — on my local device or a remote server?

The conversion runs locally in the browser with JavaScript. The converter does not need to send the entered text to a remote server.

How to convert a string to hex in TestStand

To convert a string to hex in NI TestStand, convert the string to a byte array with the encoding required by the device, then format each byte with two hex digits. A TestStand code module can perform the conversion in LabVIEW, Python, C#, or C++. Confirm the expected encoding and byte order in the target protocol. Campbell Scientific integrations and TestStand User Forum examples may use device-specific framing, so retain required separators and terminators.

ASCII text to hex,binary conversion table

This ASCII text to hex binary conversion table lists common character values in decimal, Hexadecimal, and Binary.

CharacterDecimalHexadecimalBinary
A654101000001
B664201000010
a976101100001
0483000110000
1493100110001
Space322000100000

How do I convert text to hexadecimal online?

Paste text into the Input String field to convert text to hexadecimal online. Choose the output format and copy the generated hex string.

Can I convert UTF-8 text to hex?

Yes, the converter encodes UTF-8 text as hex. UTF-8 supports ASCII, accented characters, emoji, and writing systems such as Arabic, Hindi, Japanese, and Korean.

How do I decode hexadecimal back to text?

Paste complete byte pairs into the Input Hex field to decode hexadecimal back to text. The value 48 69 decodes to Hi.

What is the difference between Hex and Base64?

Hex represents each byte with two Base16 digits, while Base64 represents bytes with a 64-character alphabet. Hex is easier to inspect byte by byte; Base64 is more compact.

How is string encoded in hexadecimal?

A string is encoded in hexadecimal by converting characters to bytes and each byte to two hex digits. The character encoding determines the bytes.

Can I convert special characters to hex?

Yes, UTF-8 special characters can be converted to hex. One character can produce several bytes, so one visible symbol can produce more than two hex digits.

Why does my hex output look different?

Hex output looks different when the character encoding, letter case, spacing, prefix, byte order, or source text differs. Compare the raw bytes before comparing formatting.

What is a hex byte?

A hex byte is an eight-bit value displayed with two hexadecimal digits. Its range is 00 to ff, equal to decimal 0 to 255.

Does the converter support multiple languages?

Yes, the UTF-8 converter supports text in multiple languages. Unicode characters are encoded into one to four UTF-8 bytes per code point.