100% local processing — your files and data never leave this browser. No uploads, no server storage.

OnboxTools

Free · Browser-only · No upload

UTF-8 encode text to bytes

Convert strings to UTF-8 hex or decimal bytes online

Utf8 encode online — paste any Unicode text and see the exact UTF-8 byte sequence as spaced hex, compact hex, or comma-separated decimal values. Built for developers debugging charset headers, protocol frames, and test fixtures.

Encoding runs entirely in your browser with native TextEncoder — nothing uploads. Use our UTF-8 Decoder to convert hex or decimal bytes back to readable text.

Need the reverse conversion?

UTF-8 Decoder
UTF-8 bytes10
Output formatHex (spaced)
Text input
UTF-8 bytes output

More Text Utilities

🔓
Base64 Decoder
🧬
Base64 Encoder
🔡
Case Converter
Cron Generator
🎨
CSS Minifier
📐
CSS Unminifier
📆
Date Format Converter
📅
Date to Unix
🔎
Find and Replace
🛡️
HTML Escape
📰
HTML Minifier
↩️
HTML to Markdown
🔓
HTML Unescape
📄
HTML Unminifier
📋
Markdown Preview
🔄
Markdown to HTML
🎲
Random Number
🔤
Random String
🔍
Regex Tester
🧹
Remove All Whitespace
↩️
Reverse Text
✂️
Split String
⚖️
Text Compare
🔁
Text Repeater
📖
Text Viewer
🌍
Time Zone Converter
🕐
Unix Time to Date
🔗
URL Encoder
🔤
UTF-8 Decoder
🌐
UTF-8 Encoder
📊
Word Counter

Browse by category

UTF-8 byte length (rule of thumb)

Code points U+0000–U+007F (ASCII) encode to 1 byte. Many Latin extended letters use 2 bytes. Most other Basic Multilingual Plane characters use 3 bytes. Supplementary characters (most emoji) often use 4 bytes in UTF-8.

JavaScript string.length counts UTF-16 code units, not UTF-8 bytes. Always use this tool's byte counter when wire size matters for headers, billing, or storage quotas.

Encoding example: “A”, “é”, and “😀”

A → 41 (one byte). é → C3 A9 (two bytes). 😀 → F0 9F 98 80 (four bytes). Three characters, seven bytes total in UTF-8.

The greeting Hello 🌍 encodes to 48 65 6c 6c 6f 20 f0 9f 8c 8d — five ASCII bytes, one space byte, and four emoji bytes. Paste that hex into the UTF-8 Decoder to recover the original string.

UTF-8 encoder output formats

FromToResult
Spaced hexExample48 65 6c 6c 6f
Compact hexExample48656c6c6f
Decimal bytesExample72, 101, 108, 108, 111
Hello 🌍Byte count9 bytes

Complete guide to UTF-8 encoding text online

What UTF-8 encoding does

UTF-8 maps every Unicode character to a sequence of one to four bytes. Unlike fixed-width encodings, ASCII letters still use a single byte while emoji and accented letters expand to two, three, or four bytes. That variable length is why a string's character count rarely equals its byte count.

When you utf8 encode text online, you are not encrypting or compressing — you are revealing the raw bytes that HTTP, JSON, databases, and filesystems actually store. Developers paste strings here to compare against hexdump output from Wireshark, firmware logs, or a misbehaving API.

This utf8 encoder uses the browser's TextEncoder API, which always outputs standard UTF-8. That matches what Node.js Buffer.from(str, 'utf8'), Python str.encode('utf-8'), and Rust str.as_bytes() produce for the same input.

Treat the hex stream as the source of truth during debugging. If two systems disagree on a string but the UTF-8 bytes match, the bug is in display or decoding — not in the original text.

How to convert string to UTF-8 hex online

Type or paste text into the input panel. The output updates live — each pair of hex digits is one byte. The letter A encodes to 41, the word Hello to 48 65 6c 6c 6f, and emoji expand to longer sequences you can copy for unit tests.

Choose spaced hex when humans will read the output — packet captures and documentation usually separate bytes with spaces. Choose compact hex when pasting into dense logs, C array literals, or tools that reject whitespace. Decimal byte mode outputs values like 72, 101, 108 for consumers that expect numeric arrays.

Copy the result with one click and paste into your decoder, test fixture, or ticket. For round-trip verification, paste the same output into our UTF-8 Decoder and confirm the original string returns unchanged.

Large pasted documents are fine within browser memory limits. Extremely long strings may feel sluggish — split by section if you only need bytes for a header or signature field.

UTF-8 vs UTF-16 and other encodings

JavaScript strings are UTF-16 internally, so string.length counts code units — not UTF-8 bytes and not visible characters when surrogate pairs appear. This tool's byte count follows UTF-8 rules, which is what wire formats almost always use.

Do not confuse UTF-8 hex with UTF-16 code units. The UTF-16 encoding of Hello uses ten bytes (two per ASCII letter) while UTF-8 uses five. Always confirm which encoding your protocol specifies before comparing hex.

UTF-8 BOM bytes (EF BB BF) sometimes prefix Windows text files. This encoder does not add a BOM by default — include one manually in your source if your consumer requires it, or strip it on decode if the consumer rejects it.

Legacy single-byte encodings like Windows-1252 or ISO-8859-1 produce different hex for the same visual character. If decode fails or looks wrong, verify the source file was actually UTF-8.

When to use a UTF-8 byte encoder

API debugging: encode a known payload here, then compare the hex to raw response bytes in your network tab. A mismatch under charset=utf-8 often means gzip compression, double encoding, or a wrong Content-Type label.

Cryptography and signing: HMAC, SHA, and Ed25519 operate on bytes. Two visually identical strings can hash differently if one uses curly quotes (multi-byte UTF-8) and the other uses straight ASCII quotes. Encode both and diff the hex before blaming the signature algorithm.

Firmware and embedded docs: hardware teams document string tables as hex byte arrays. Export decimal or spaced hex directly into C headers, Rust const arrays, or Python bytes literals.

Test fixtures: store expected UTF-8 sequences as hex in JSON test files so CI asserts exact wire bytes, not just rendered glyphs that fonts might hide.

Output formats explained

Spaced hex (48 65 6c 6c 6f) mirrors hexdump -C and Wireshark byte views. It is the easiest format for human review and code review comments.

Compact hex (48656c6c6f) removes whitespace for hash inputs, compact JSON fields, and regex-friendly logs. Decoders accept both forms — spaces are cosmetic.

Decimal bytes (72, 101, 108, 108, 111) suit spreadsheet imports, PLC configs, and teaching materials that reference numeric ASCII tables. Each value must stay in the 0–255 range.

Lowercase hex is the default output style. Uppercase hex represents identical bytes — case is never semantically meaningful.

Privacy and related tools

TextEncoder runs locally in your browser. Passwords, tokens, customer names, and internal error messages never upload to a server. Clear the textarea when finished on shared machines.

Pair with our UTF-8 Decoder for reverse conversion. Use Base64 Encoder when you need to wrap bytes for JSON or email — Base64 is transport encoding, not raw byte display.

URL percent-encoding (%C3%A9 for é) is for addresses and query strings, not general byte inspection — use our URL Encoder for that layer. Use HTML Escape when the problem is markup escaping, not charset bytes.

Document the hex format you paste into tickets (spaced vs compact vs decimal) so teammates reproduce the same bytes without guessing.

Detailed guide

Verifying an API charset header

Encode a known string here, then compare the hex to raw response bytes in your browser network tab or curl --output - | xxd. If headers say charset=utf-8 but bytes differ, check for gzip, BOM stripping, or a Latin-1 mislabel.

Latin-1 misread as UTF-8 produces distinctive replacement characters. Compare hex from both sides before assuming the server returned the wrong JSON field.

Building test fixtures from UTF-8 hex

Copy compact hex into a test assertion: expected bytes should equal the encoder output for your canonical input string. That catches smart-quote and whitespace regressions invisible in rendered UI.

Store decimal arrays when your language prefers numeric byte literals — paste encoder output directly into Rust, C, or Python tests without manual conversion.

Common questions

UTF-8 Encoder FAQ

What does utf8 encode online mean?

It converts human-readable Unicode text into the raw UTF-8 byte sequence used on the wire — shown as hex or decimal values you can copy for debugging and test fixtures.

How do I convert string to utf8 hex online?

Paste your text, pick spaced or compact hex output, and copy the byte stream. Each hex pair is one UTF-8 byte.

What is the difference between utf8 encoder and utf8 converter?

Both terms describe the same action — turning text into UTF-8 bytes. This page focuses on encode-only output; use the UTF-8 Decoder for the reverse direction.

What hex format should I use?

Spaced hex is easiest to read. Compact hex has no spaces. Decimal shows comma-separated byte values from 0 to 255.

Why do emoji use four bytes in UTF-8?

UTF-8 is variable length. ASCII letters use one byte; many emoji need four bytes even though they display as one character.

How do I decode the output?

Open our UTF-8 Decoder, paste the hex or decimal bytes, and read the recovered text.

Is utf8 encoding the same as URL encoding?

No. This shows raw UTF-8 bytes. Percent-encoding (%C3%A9) is for URLs — use our URL Encoder for that.

Does the UTF-8 Encoder send my input to a server?

Yes. Everything runs in your browser. Your input is not uploaded, logged, or stored on our servers.

Do I need an account?

No account or sign-up is required. Open the page and start using the tool immediately.