Skip to main content

String to Bytes

Convert a string to UTF-8 bytes online. View Hex or decimal byte arrays, customize prefixes and separators, and copy the result.

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 Bytes converter?

A String to Bytes converter encodes characters as numeric byte values. This tool uses UTF-8, the encoding commonly used by web pages, APIs, source files, and network payloads.

Hex and decimal are two ways to display the same bytes. Changing the output preset, prefix, separator, or Hex case changes only the notation, not the encoded data.

How to convert a string to bytes

  1. Type or paste a string, or select Example.
  2. Select Raw Hex, Hex Array, Decimal Array, or Escaped Bytes.
  3. Open Options when you need a different Hex case, byte prefix, or separator.
  4. Copy the generated byte sequence.

The result updates immediately. The default is uppercase, space-separated UTF-8 Hex with no prefix.

String to bytes examples

The ASCII string Hello uses five UTF-8 bytes:

OutputResult
Raw Hex48 65 6C 6C 6F
Hex Array[0x48, 0x65, 0x6C, 0x6C, 0x6F]
Decimal Array[72, 101, 108, 108, 111]
Escaped Bytes\x48\x65\x6C\x6C\x6F

Unicode characters may use more than one byte. The character becomes E4 BD A0, so one character uses three UTF-8 bytes. The Emoji 👋 becomes F0 9F 91 8B and uses four bytes.

How string-to-bytes conversion works

The conversion has two separate stages:

String → UTF-8 encoding → Raw bytes → Hex or decimal display

UTF-8 determines the byte values. The selected preset and Options determine only how those values are written. A decimal value such as 72 and the Hex value 48 can therefore represent the same byte.

String to Bytes vs String to Hex

String to Bytes emphasizes byte sequences and byte arrays. It supports Hex and decimal values, array brackets, byte prefixes, and custom separators for code or debugging workflows.

The String to Hex Converter focuses on hexadecimal strings and common Hex code formats. Use it when you only need Hex output and do not need decimal byte arrays or custom notation.

Character count vs byte count

A character does not always equal one byte. ASCII characters usually use one UTF-8 byte, while accented characters, CJK text, symbols, and Emoji may use two, three, or four bytes. Combining marks and joined Emoji can also make visual character counting more complex.

This tool reports the encoded byte count. Use the String Length Calculator to compare visible characters, Unicode code points, UTF-16 code units, and UTF-8 bytes.

Output format guide

FormatExampleCommon use
Raw Hex48 65 6CInspecting encoded data and protocols
Hex Array[0x48, 0x65, 0x6C]Source code and test fixtures
Decimal Array[72, 101, 108]APIs and byte-array values
Escaped Bytes\x48\x65\x6CEscaped byte strings

Custom prefix and separator values are inserted literally. For example, the prefix byte: and separator | produce byte:48 | byte:65.

String to Bytes FAQ

Which character encoding does this tool use?

It always uses UTF-8. It does not add a byte order mark or offer other character encodings.

Are Hex and decimal different bytes?

No. They are different numeric representations of the same byte values. For example, Hex FF and decimal 255 represent the same byte.

Does the tool interpret escape sequences in custom values?

No. Custom prefixes and separators are inserted exactly as entered.

Can this tool convert bytes back into a string?

No. Decoding bytes requires parsing the input notation and knowing the original character encoding, so it is a separate operation.