Convert ASCII to Bytes

Convert text to UTF-8 byte values - decimal, hex, binary, octal, with JSON or C array output. Free, client-side, instant, offline.

Encode text as a UTF-8 byte array β€” decimal, hex, binary, or octal, wrapped in a plain sequence, a JSON literal, or a C initializer. Unicode-safe.

How to Use Convert ASCII to Bytes

  1. Type or paste text into the input - ASCII, Latin characters, CJK, and emoji all work. The output recomputes within 150 ms of your last keystroke.
  2. Pick a byte format: decimal (default), hex (00-FF), binary (8-bit groups), or octal. Hex is the most common for file dumps, binary for protocol work, octal for POSIX file modes.
  3. Choose a wrapping: a plain space-separated list for quick copies, comma-separated for CSV, one-per-line for readable diffs, JSON array for pasting into a JS/TS literal, or C array for uint8_t[] initializers.
  4. Tick UPPERCASE hex if you prefer FF over ff (default on). The toggle has no effect for decimal and octal output.
  5. Tick Zero-pad to force fixed-width tokens - 01 08 0F in hex or 00000001 00001000 in binary. Handy for aligned dumps.
  6. Add a per-byte prefix like 0x for C literals or 0b for assembly. Works with any format and combines with the wrapping.
  7. Check the stats line: input characters, UTF-8 bytes, min/max byte value, and the count of multi-byte characters - helpful when you want to spot non-ASCII input quickly. Copy, Download, or press Ctrl+Enter to run and copy in one shortcut.

Frequently asked questions

What is a byte in this context?

An 8-bit unsigned integer between 0 and 255. The tool runs your text through TextEncoder, which produces UTF-8 bytes, and then prints each one in your chosen format.

Why would I convert text to bytes?

For protocol analysis, firmware development, test fixtures, debugging encoding issues, generating C/JS array literals, or learning how computers store text at the byte level.

What output formats can I pick?

Decimal (0-255), hexadecimal (00-FF), binary (8-bit groups), and octal (000-377). Each has its own default pad width; the zero-pad toggle enforces fixed-width output.

Is my data secure?

Yes. Encoding runs entirely in your browser – nothing is uploaded, cached, or tracked. After the page loads you can disconnect the network and keep encoding indefinitely.

ASCII or UTF-8 bytes?

UTF-8. Plain ASCII (0-127) looks identical in both, but the tool uses TextEncoder so non-ASCII characters correctly expand to their multi-byte UTF-8 form.

Does it work offline?

Yes. HTML, CSS, and JavaScript are self-contained. Once the page has loaded, you can turn off Wi-Fi and the tool keeps working – useful on air-gapped machines.

Is it free?

Yes, 100% free with no cap on input length or number of encodes. No sign-up, no premium tier, no watermark.

What output shapes are useful for code?

The JSON-array and C-array wrappings are paste-ready literals. JSON ([72, 101, 108]) drops into any JS/TS/Python list. C-array ({ 0x48, 0x65, 0x6C }) fits directly into a uint8_t[] initializer – enable hex format, zero-pad, and the 0x prefix for the cleanest result.

Does it handle emoji?

Yes. Emoji encode to 4 UTF-8 bytes – πŸ˜€ becomes F0 9F 98 80 in hex. The “multi-byte chars” counter in the stats line tells you how many characters expanded beyond one byte.

How do I convert bytes back to text?

Use the sibling Bytes to ASCII converter. Round-trip is exact: the byte array out of this tool pastes cleanly into the other for decoding back to the original string.