String to Bytes Converter

How to Use This Converter

Using this text-to-code converter is straightforward—no tech expertise needed! Just follow these 3 simple steps to turn your text into hex, binary, decimal, octal, or Base64, whether you’re working with a quick phrase or a whole file.

  1. Input Your Text
    • Type or paste any text directly into the input box—this works for everything from short sentences to long paragraphs, emojis, or special symbols (like !@#$ or accented letters like ĂŠĂą).
    • Supports all Unicode characters (emojis, special symbols): No more garbled output if you include 😊, 你弽, or ñ—we handle all global characters seamlessly.
    • Alternatively, upload a text file using the file button: Perfect for longer content (like .txt or .csv files). We recommend keeping files under 5MB to keep conversion fast—no waiting around!
    • Pro tip: If you’re copying text from a document or chat, just paste it right in—we’ll preserve spaces, line breaks, and tabs so your output matches the original structure.
  2. Select Output Format
    • Choose from hexadecimal, binary, decimal, octal, or Base64—pick the one that fits your project:
      • Hexadecimal: Great for programming (e.g., embedding in code) or debugging network data.
      • Binary: Useful for hardware projects (like microcontrollers) or learning how computers store text.
      • Decimal: Easy to read for anyone new to code—just simple numbers (0-255) per character.
      • Octal: Less common, but handy for legacy systems or specific programming use cases.
      • Base64: Ideal for sending text over networks (e.g., in URLs, emails, or APIs) since it’s web-safe.
    • Each format displays the byte representation differently: For example, the letter "H" becomes 48 (hex), 01001000 (binary), or 72 (decimal)—same character, just different ways to represent it.
  3. Configure Options
    • Control spacing between bytes for readability: Choose "spaced" (e.g., 48 65 6C) if you want to easily match bytes to characters, or "no space" (e.g., 48656C) for compact output (great for code).
    • Toggle uppercase for hexadecimal output: Uppercase (48 65 6C) is easier to read in docs, while lowercase (48 65 6C) fits most coding style guides—your call!
    • Include ASCII representation where applicable: Adds a small label under your output (e.g., "48 (H) 65 (e)") so you can double-check that the conversion matches your original text—super helpful for debugging.
  4. Final Step: Convert & Use!
    • Click the "Convert" button—your output will show up instantly.
    • Copy the result with one click (look for the "Copy" button) to paste into code, docs, or tools.
    • If you make a mistake, just hit "Clear" to start over—no hassle.

Technical Details

Here’s the "behind-the-scenes" stuff to help you understand how the conversion works—and why we made the choices we did. You don’t need to know this to use the tool, but it’s handy if you’re curious or troubleshooting.

Character Encoding

All conversions use UTF-8 encoding by default—here’s why that matters:

  • Supports multi-byte characters (1-4 bytes per character): Unlike older encodings (like ASCII) that only handle English, UTF-8 works for every language—Chinese, Spanish, Arabic, and even emojis!
  • ASCII characters use 1 byte (compatible with ASCII encoding): Basic English letters, numbers, and symbols (A-Z, 0-9, !) only take 1 byte—so if you’re working with simple text, it’s just as efficient as ASCII.
  • Non-ASCII characters use 2-4 bytes as needed: For example:
    • Spanish "Ăą" = 2 bytes (C3 B1 in hex)
    • Chinese "ä˝ " = 3 bytes (E4 BD A0 in hex)
    • Emoji "😊" = 4 bytes (F0 9F 98 8A in hex)
  • Why not other encodings? UTF-8 is the most universal—used on 95% of websites and all modern apps. It avoids䚹码 (garbled text) that happens with encodings like GBK or Shift-JIS when used for the wrong language.

Format Specifications

Here’s exactly how each output format is structured—no surprises:

  • Hexadecimal: Each byte as two hex digits (00-FF). We pad with a leading zero if needed (e.g., the byte 5 becomes "05", not "5") to keep everything consistent. You can also toggle "0x" prefix (e.g., 0x48 0x65) if your code needs it.
  • Binary: Each byte as 8 bits (00000000-11111111). We always use 8 bits per byte (even if the first bits are zero) so you can easily count bytes—no guessing if it’s 4 bits or 8 bits.
  • Decimal: Each byte as a number (0-255). This is the simplest format for beginners—each number directly maps to a byte’s value (e.g., 72 = "H", 32 = space).
  • Octal: Each byte as three digits (000-377). Octal uses base-8 (digits 0-7), so we pad with leading zeros to make sure every byte is three digits—consistent with how octal is used in systems.
  • Base64: Entire string encoded as Base64. Base64 takes 3 bytes of text and turns them into 4 characters (using A-Z, a-z, 0-9, +, and /). If your text length isn’t a multiple of 3, we add "=" padding at the end (standard Base64 practice).

Error Handling

We’ve built in checks to avoid common issues:

  • Invalid characters: If you try to upload a non-text file (like .jpg or .pdf), we’ll show an error—stick to .txt or .csv!
  • Too-large files: If you upload a file over 10MB, we’ll ask you to shrink it—this keeps the tool fast for everyone.
  • Encoding mismatches: If your text uses a rare encoding (not UTF-8), we’ll suggest switching to UTF-8 to avoid garbled output.

Conversion Examples

Seeing is believing! Check out these real-world examples to see how different texts convert to each format. We’ve included common use cases—from simple English to emojis and non-English text.

1. Basic English Text ("Hello World")

Input string:

"Hello World"

Hexadecimal (spaced, uppercase):

48 65 6C 6C 6F 20 57 6F 72 6C 64

Binary (spaced):

01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100

Decimal (spaced):

72 101 108 108 111 32 87 111 114 108 100

2. Text with Emoji ("Hi! 😊")

Input string:

"Hi! 😊"

Hexadecimal (spaced, lowercase):

48 69 21 20 f0 9f 98 8a

Base64:

SGkhIPCfkqE=

Note:

The emoji "😊" uses 4 bytes (f0 9f 98 8a) in UTF-8—hence the longer hex output!

3. Non-English Text ("你弽, World!")

Input string:

"你弽, World!"

Hexadecimal (0x prefix):

0xE4 0xBD 0xA0 0xE5 0xA5 0xBD 0x2C 0x20 0x57 0x6F 0x72 0x6C 0x64 0x21

Decimal:

228 189 160 229 165 189 44 32 87 111 114 108 100 33

Note:

Chinese characters "你" (E4 BD A0) and "弽" (E5 A5 BD) each use 3 bytes in UTF-8.

4. Format Options Demo ("Test")

Input string:

"Test"

Options Used:

1. Hex (uppercase, no space)
2. Hex (lowercase, spaced)
3. Hex (0x prefix)

Output 1:

54657374

Output 2:

54 65 73 74

Output 3:

0x54 0x65 0x73 0x74

Frequently Asked Questions (FAQs)

Why does my emoji take 4 bytes instead of 1?

Great question! Emojis are "supplementary characters" in Unicode—they don’t fit in the 1-byte range (0-127) that basic English uses. UTF-8 uses 4 bytes for emojis to cover all possible Unicode symbols. It’s normal, and our tool handles it automatically!

My output looks garbled—what’s wrong?

9 times out of 10, it’s an encoding issue. Make sure your input text uses UTF-8 (most modern apps like Word, Notepad, or Slack use UTF-8 by default). If you copied text from a legacy document (old Word files, for example), it might use ISO-8859-1—try re-saving the file as UTF-8 first, then upload again.

Can I convert binary/hex back to text with this tool?

Right now, this tool only goes from text to code (hex, binary, etc.). If you need the reverse (e.g., hex to text), we have a separate "Code to Text Converter"—look for the link at the bottom of the page!

Is there a limit to how much text I can convert?

For pasted text, no hard limit—you can paste as much as you want (though very long text might take a second to process). For files, we recommend keeping it under 5MB to avoid slowdowns. If you have a 10MB file, split it into two smaller files—works like a charm!

Why would I use Base64 instead of hex?

Base64 is better for sending text over the internet. Hex uses 2 characters per byte, while Base64 uses ~1.33 characters per byte—so it’s more compact. Plus, Base64 uses web-safe characters (no + or / in some versions) that work in URLs and emails, whereas hex can have issues with certain tools.

Need the reverse tool? Convert Bytes to String →