Skip to main content

String to Hex

Convert strings to lowercase UTF-8 Hex bytes online. Copy compact Hex, spaced bytes, 0x-prefixed bytes, JavaScript arrays, or C arrays.

Your tool input is processed locally in your browser—not uploaded to or stored by Bitty Coder. Privacy Policy

Input
UTF-8
Output
HEX

What is a String to Hex converter?

A String to Hex converter encodes a string as bytes and writes each byte as a two-digit hexadecimal value. This tool uses UTF-8, the encoding commonly used by web pages, APIs, source files, and network payloads.

The result is a byte representation of the string content. It is useful for inspecting encoded data, creating fixtures, comparing payloads, and preparing byte arrays for source code.

How to convert a string to Hex

  1. Type or paste a string, or select Example.
  2. Select an Output format in the toolbar.
  3. Copy the generated Hex output.

The default is Spaced Bytes. The result updates immediately, and there is no Convert button.

String to Hex example

In the default Spaced Bytes format, the ASCII string Hello becomes:

48 65 6c 6c 6f

Each pair represents one byte: 48 is H, 65 is e, and 6c is l.

Available Hex formats

The same Hello string can be written in several developer-friendly forms:

FormatOutput
Compact Hex48656c6c6f
Spaced Bytes48 65 6c 6c 6f
0x Bytes0x48 0x65 0x6c 0x6c 0x6f
JavaScript Array[0x48, 0x65, 0x6c, 0x6c, 0x6f]
C Array{0x48, 0x65, 0x6c, 0x6c, 0x6f}

Changing the format changes only the notation, not the byte values.

UTF-8 strings and multiple bytes

ASCII characters use one UTF-8 byte each. Many accented characters, symbols, and Emoji use multiple bytes. For example, é becomes c3a9, while 👋 becomes f09f918b.

Use the String Length Calculator when you need to compare visible characters, Unicode code points, UTF-16 code units, and UTF-8 byte counts.

String encoding vs Hex string parsing

Encoding Hello as Hex produces 48656c6c6f. This tool performs that operation.

Parsing the string FF as a hexadecimal number is a different task: it interprets existing Hex digits as the decimal value 255. This tool does not parse Hex numbers or decode Hex back into a string.

For decimal arrays or customizable byte notation, use String to Bytes.

String to Hex FAQ

What is Hello as a Hex string?

In the default Spaced Bytes format, Hello is 48 65 6c 6c 6f. Select Compact Hex to get 48656c6c6f.

How do I create a Hex byte array?

Select JavaScript Array for square brackets or C Array for braces. Every item receives a 0x prefix.

Why does one Unicode character produce several Hex bytes?

UTF-8 uses a variable number of bytes. ASCII characters use one byte, while many other characters use two, three, or four bytes.

Does lowercase Hex change the value?

No. ff and FF represent the same byte value. This tool consistently outputs lowercase letters.

Is a Hex string the same as a hexadecimal number?

Not necessarily. A Hex string can represent encoded bytes, while a hexadecimal number represents a numeric value. The intended data type and encoding determine how the digits should be interpreted.