Binary Code Converter — Free Binary Converter for Text, Decimal & Hex
Last updated:
A free binary converter for binary code, text, decimal numbers, hexadecimal and ASCII. Pick a direction, paste your input and the result appears as you type. Everything runs in your browser — no signup, no upload, no tracking.
Multi-mode binary converter
Try an example
Click any example to load it into the converter above and switch to the right mode.
What this binary converter does
Six conversion modes share one screen, so you can move between representations of the same data without switching tabs. Students use it to check homework on number bases, CTF players to decode bit strings, and developers to read the raw bytes behind a value. Each direction also has a dedicated page with more detail:
- Text ⇄ binary — encode words as 8-bit bytes or decode bits back into text with the Binary Code Translator (UTF-8, ASCII or Latin-1).
- Decimal ⇄ binary — whole numbers of any size, plus signed two's complement, on Decimal to Binary and Binary to Decimal.
- Hex ⇄ binary — one hex digit is exactly four bits; see Hex to Binary and Binary to Hex.
- Strict ASCII — when you need the 7-bit ASCII table rather than UTF-8, use Binary to ASCII, ASCII to Binary or Hex to ASCII.
How binary numbers work
Binary is base 2: every position is worth twice the one to its right. An 8-bit byte has these place values, and a 1 in a position means "add this value".
| Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 01000001 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |
In the example row only the 64 and 1 positions are on, so 01000001 = 64 + 1 = 65 — which is also the character code of the capital letter A. That single fact is the bridge between numbers and text: a text-to-binary conversion looks up each character's code and writes it in base 2.
Binary to decimal by hand
Write the place values over the bits and add up the ones that are switched on. For 10110101: 128 + 32 + 16 + 4 + 1 = 181. Leading zeros never change the value, so 00000101 and 101 are both 5.
Decimal to binary by hand
Divide by 2 repeatedly and keep the remainders, then read them from the bottom up. For 156:
156 ÷ 2 = 78 remainder 0 78 ÷ 2 = 39 remainder 0 39 ÷ 2 = 19 remainder 1 19 ÷ 2 = 9 remainder 1 9 ÷ 2 = 4 remainder 1 4 ÷ 2 = 2 remainder 0 2 ÷ 2 = 1 remainder 0 1 ÷ 2 = 0 remainder 1 Read upward: 10011100 (128 + 16 + 8 + 4 = 156)
Binary and hex: the 4-bit shortcut
Hexadecimal (base 16) exists because it lines up perfectly with binary: one hex digit always equals four bits, so a byte is always two hex digits. Converting between them is just a table lookup — no arithmetic. 0xB5 is 1011 + 0101 = 10110101.
| Hex | Decimal | Binary | Hex | Decimal | Binary |
|---|---|---|---|---|---|
0 | 0 | 0000 | 8 | 8 | 1000 |
1 | 1 | 0001 | 9 | 9 | 1001 |
2 | 2 | 0010 | A | 10 | 1010 |
3 | 3 | 0011 | B | 11 | 1011 |
4 | 4 | 0100 | C | 12 | 1100 |
5 | 5 | 0101 | D | 13 | 1101 |
6 | 6 | 0110 | E | 14 | 1110 |
7 | 7 | 0111 | F | 15 | 1111 |
ASCII binary table: letters and digits
The 8-bit binary code for every English letter and digit. Uppercase letters start at 01000001 (65), lowercase at 01100001 (97) — the only difference is the bit worth 32, which is why flipping one bit changes the case. Digits start at 00110000 (48), so the last four bits of a digit's code are the digit itself.
Uppercase
0100000101000010010000110100010001000101010001100100011101001000010010010100101001001011010011000100110101001110010011110101000001010001010100100101001101010100010101010101011001010111010110000101100101011010Lowercase
0110000101100010011000110110010001100101011001100110011101101000011010010110101001101011011011000110110101101110011011110111000001110001011100100111001101110100011101010111011001110111011110000111100101111010Digits
00110000001100010011001000110011001101000011010100110110001101110011100000111001A space is 00100000 (32). Accented letters, other scripts and emoji are outside ASCII and take two to four bytes in UTF-8 — the translator handles those automatically.
Quick examples
| Text | Binary (UTF-8) |
|---|---|
| A | 01000001 |
| Hi | 01001000 01101001 |
| Hello | 01001000 01100101 01101100 01101100 01101111 |
How to use
- Pick a conversion mode from the buttons above (e.g. Text → Binary or Binary → Text).
- Type or paste your input into the Input box. You can also click Open file or drag a
.txtfile directly onto the input area. - Adjust the Separator option if you want different output spacing (space, none, comma, or newline).
- The result appears instantly in the Output box. Click Copy to copy it to your clipboard, or Swap to reverse the conversion.
Frequently asked questions
How do I convert text to binary?
Type any text in the Input box. The tool converts each character to its 8-bit binary code (UTF-8 encoded) and displays the result instantly. Spaces separate bytes for readability.
How do I convert binary back to text?
Switch the mode to "Binary → Text", paste your binary code (with or without spaces). The tool groups bits into 8-bit bytes and decodes them as UTF-8 text.
Why do I see "Decoded bytes are not valid UTF-8"?
Your binary likely came from a different encoding (e.g., raw bytes, Latin-1) or is corrupted. Try Binary → Decimal or Binary → Hex to inspect the raw numbers instead.
How do I convert a decimal number to binary?
Switch to "Decimal → Binary" and type a non-negative integer (e.g. 255). The tool returns the unsigned base-2 form — 255 becomes 11111111. No leading zero padding is added.
Why does my decimal show as a huge string of 0s and 1s?
Each extra digit roughly triples the bit count, and the tool uses BigInt so there is no 53-bit precision ceiling. A 30-digit decimal legitimately produces a ~100-bit binary string — that is correct output, not a glitch.
Can I convert negative numbers?
Plain decimal → binary rejects negatives because raw binary has no sign. For signed values use the signed (two's complement) checkbox and pick a bit width (8, 16, 32, or 64) so the encoding is unambiguous.
How is hex (hexadecimal) related to binary?
Each hex digit maps to exactly 4 bits, so one byte is always two hex digits. That is why "Hex → Binary" expands 0xFF into 11111111 and 0xAB into 10101011 — direct 4-bit groupings with no math involved.
Can I paste hex with a 0x prefix?
Yes. The tool strips a leading 0x (case-insensitive) and ignores all whitespace before parsing, so "0xDEAD BEEF", "DEADBEEF", and "de ad be ef" all give the same binary output.
What is the maximum input length?
The tool accepts up to 100,000 characters per conversion. For larger batches, split your input or use the command-line equivalent.
Is my input sent to your servers?
No. All conversion happens entirely in your browser using JavaScript. We never see what you type, and no input is transmitted.