Binary to Decimal Converter – and Text to Binary
Convert text to space-separated binary values or turn binary groups back into text. Enter your content and choose To Binary or To Text.
Text to Binary Code Converter
Binary Converter Formula
Where:
- \(u_i\) — the numeric value of one UTF-16 code unit in the input text.
- \(b_i\) — its binary representation, padded on the left to at least eight digits; when decoding, one whitespace-separated binary group.
- \(c_i\) — the character produced by decoding a binary group.
To Binary converts each UTF-16 code unit separately and joins the resulting groups with spaces. To Text parses each whitespace-separated group as a base-2 number and converts it to a UTF-16 code unit.
Binary Converter – Calculation Example
Example: enter Hi in Content and select To Binary. The code-unit values of H and i are 72 and 105.
\[ 72_{10}=01001000_2,\qquad 105_{10}=01101001_2 \]
Result: 01001000 01101001. To recover Hi, enter those two groups in Content and select To Text.
How to use the calculator
- Enter text or binary codes in Content. For binary-to-text conversion, separate each binary value with whitespace, such as a space or line break.
- Set Type to To Binary to encode text, or To Text to decode binary groups.
- Read or copy the converted content from Result. If you get an unexpected character, check the binary groups and the selected direction.
What the binary result means
Binary is a base-2 number system: each digit is either 0 or 1. This converter represents the numeric value of each JavaScript UTF-16 code unit in binary. For familiar English letters, digits and punctuation, those values match ASCII codes. For example, uppercase A has the value 65, so its output is 01000001. The spaces between output groups make it possible to identify and decode each value separately.
The padding in To Binary sets a minimum width of eight digits, not a fixed width. Values above 255 therefore produce longer groups. Some symbols, including many emoji, consist of two UTF-16 code units and produce two binary groups. This is why the output should not be assumed to be a sequence of eight-bit bytes or a UTF-8 encoding.
To Text works in the opposite direction: it treats every whitespace-separated group as a binary number, then converts the value to a character. For example, 01001000 01101001 becomes Hi. If you need to inspect character codes in another form, try the ASCII Converter or Hex Converter. For a different way of representing text for transmission, see the Base64 Encoder; Base64 is not binary notation.
Assumptions and practical tips
The calculator removes whitespace from the beginning and end of the entire Content input before converting it. Spaces within text are retained and encoded as characters. If you need to encode leading or trailing spaces, this tool will not preserve them as entered.
When decoding, use one binary group per character code unit. The example output from To Binary is a reliable format to paste back into To Text. Decoding does not check that a group contains only 0s and 1s: JavaScript may stop parsing at an invalid digit or produce an unexpected character. Review the input if the result looks wrong, rather than treating it as validated binary data.
This is a text-code-unit converter, not a file or byte encoder. In particular, its output for non-ASCII text can differ from the bytes used when that text is saved as UTF-8. For dependable comparisons, make sure both sides of a conversion use the same character representation and group boundaries.
Frequently Asked Questions
How can I convert a letter to binary by hand?
Look up the letter’s character code, convert that number to base 2, and add leading zeroes until it has at least eight digits. For example, A has code 65. Since 65 = 64 + 1, its binary value is 1000001, padded to 01000001. To decode it, add the place values marked by 1s and look up the resulting code.
Do leading zeroes change the character when converting binary to text?
No. Leading zeroes do not change a binary number’s value, so 1000001 and 01000001 both decode to A. The converter adds zeroes when encoding to make small values easier to read, but it does not require them when decoding. Keep the groups separated so it knows where one character code ends and the next begins.
Can I paste a continuous string of bits without spaces?
Not if it represents several characters. The converter treats each whitespace-separated group as one number; it does not automatically divide a continuous string into eight-bit chunks. For example, to decode two letters, separate their codes with a space or line break. This matters especially because some encoded groups are longer than eight bits.
Why does the binary for an accented letter differ from its UTF-8 bytes?
This converter uses UTF-16 code units, while UTF-8 uses a different encoding that can represent the same character with different numbers of bytes. For example, é appears here as one group, 11101001, but its UTF-8 bytes are 11000011 10101001. Use a UTF-8 byte converter if you need the binary contents of a saved UTF-8 file.
Why does an emoji produce two binary groups?
Many emoji have a Unicode value that UTF-16 represents using a pair of code units, called a surrogate pair. The converter processes each code unit separately, so one visible emoji can produce two groups. Both groups must be kept in the correct order to recover it. The number of binary groups therefore does not always equal the number of visible characters.
Why does the decoded result appear blank or contain a strange symbol?
A binary group can decode to a control character, such as a tab or line break, that may not appear as a visible symbol. An unusually large value or a group containing nonbinary digits can also produce an unexpected result because the input is not strictly validated. Check each group’s digits and boundaries, and use a character-code inspector if the output remains unclear.
3 thoughts on “Binary to Decimal Converter – and Text to Binary”