How to use the Binary Data Converter
- Paste your data into the left pane: hex, Base64, a byte array copied from code, bits, or plain text.
- From: leave it on Detect, or pick the input format when it is ambiguous.
- To: choose the output — another encoding, text, a hex dump or a byte-array literal for C, JavaScript, Python, Go, Java or Rust.
- For hex output, pick a Hex style (
deadbeef,de ad be ef,de:ad:be:ef,0xde, 0xador\xde\xad) and whether to use uppercase. - Copy or Download the result. The status bar shows the number of bytes and which input format was used.
Example
The hex bytes 48 65 6c 6c 6f 2c 20 54 69 64 79 70 61 6e 65 21 20 f0 9f 91 8b become this Base64:
SGVsbG8sIFRpZHlwYW5lISDwn5GL
and, as a Go literal:
[]byte{
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x54, 0x69, 0x64, 0x79, 0x70,
0x61, 0x6e, 0x65, 0x21, 0x20, 0xf0, 0x9f, 0x91, 0x8b,
}
Formats in detail
- Hex ignores spaces, line breaks, colons, dashes, commas and brackets, and strips
0xprefixes and\xescapes, so a hex dump copied from a debugger or a Wireshark export usually reads as is. An odd number of digits is reported, because a byte always needs two. - Base64 accepts the standard and URL-safe alphabets in the same input, with or without
=padding, and a leadingdata:…;base64,header. For text-only work, the Base64 encoder adds MIME line wrapping and other options. - Base32 follows RFC 4648 (A–Z and 2–7), the alphabet used for TOTP secrets — see the TOTP generator.
- Base58 uses the Bitcoin alphabet, which leaves out
0,O,Iandlto avoid look-alikes; leading zero bytes become leading1s. Because the encoding is quadratic, input is limited to 20,000 characters. - Ascii85 handles the
zshortcut for zero groups, partial final groups and the<~ … ~>delimiters used in PostScript and PDF. - Byte arrays are read from the list after
=in C, Java and Rust code, and from the brackets or braces in JavaScript, Go and Python; casts such as(byte)and Rust’su8suffix are ignored. Python and Rustb'…'literals understand\xand the usual escapes.
When to use it
Use it to turn a key from a config file into the byte array your code needs, to decode a hex blob from a log into readable text, to check what a Base58 address or a Base32 secret contains, or to compare two encodings of the same bytes. To see a whole file byte by byte, open it in the Hex Dump viewer; to hash bytes, use the hash generator; to convert single numbers between bases, use the number base converter.
Frequently asked questions
Which formats can it read and write?
It reads hex (plain, spaced, colon-separated, 0x-prefixed or \x-escaped), Base64 and Base64URL (with or without padding, data: URIs too), Base32, Base58, Ascii85, bits, decimal bytes, byte-array literals from C, JavaScript, Python, Go, Java and Rust, and text as UTF-8 or UTF-16LE. It writes all of those, plus an xxd-style hex dump.
How does Detect pick the input format?
It looks at the shape of what you paste: a list in braces or brackets, or a b'…' literal, is a byte array; only 0s and 1s in groups of up to 8 are bits; pairs of hex digits are hex; small numbers separated by commas or spaces are decimal bytes; anything else is read as Base64. Choose the format explicitly when the guess is wrong, for example a hex string that is also valid Base64.
Why does Text (UTF-8) output fail for some data?
Arbitrary bytes are often not valid UTF-8 — a key, a hash or a compressed file, for example. Rather than show replacement characters that hide what the bytes are, the converter says so; switch the output to Hex or Hex dump to see them.
Are Java's negative bytes supported?
Yes. Java and Kotlin print bytes as signed numbers from -128 to 127, so -1 is read as 0xff. When writing a Java byte[] literal, values above 0x7f get a (byte) cast so the code compiles.
Is my data uploaded?
No. Everything is converted in your browser, so keys, tokens and payloads never leave the tab.
Last updated