VITON13School

VITON13 SCHOOL · Codes and ciphers

Binary translator and binary converter

Text to binary and back, numbers in any base from 2 to 36 — everything updates as you type, with the working shown the way a textbook writes it.

By , Founder of VITON13 SCHOOL

Text

Type on either side. Binary and hex can be pasted with or without spaces. The bytes are UTF-8, so accents, Cyrillic and emoji work.

Bytes as

Characters: 5 · bytes: 5 · bits: 40

Try

Character by character

UTF-8 writes a Latin letter in 1 byte, Cyrillic in 2, € in 3 and most emoji in 4. The light bits say how many bytes belong together; the dark bits are the character's own number.

  • HU+00480100100048
  • eU+00650110010165
  • lU+006C011011006C
  • lU+006C011011006C
  • oU+006F011011116F

How to use the binary converter

  1. Type text or a numberOn the Text tab, type on either side: letters turn into UTF-8 bytes, and pasted binary, hex or decimal bytes turn back into text. On the Numbers tab, type in any field — binary, octal, decimal, hex or any base.
  2. Read the stepsUnder the converter, the solution is written out: repeated division for the whole part, multiplication for the fraction, place values back to decimal, and groups of four bits between binary and hex.
  3. Check signed numbersThe Signed tab shows two's complement in 8, 16, 32 or 64 bits with the range. Tap any bit to flip it, and the table tab lists 0–15 and the powers of two.

How positional number systems work

In a positional system each place is worth the base raised to a power: in binary the places are 1, 2, 4, 8, 16 and so on, so 1011₂ = 8 + 0 + 2 + 1 = 11₁₀. Bases above 10 need more digit symbols, so letters are used: A = 10, B = 11, up to Z = 35 in base 36.

A fraction ends in a base only when its denominator, in lowest terms, has no prime factors other than those of the base. 1/10 has the factor 5, which 2 does not have, so 0.1 has no finite binary form: it is 0.0(0011)₂, with 0011 repeating forever. The converter finds such cycles and shows them in brackets.

Computers store text as numbers. UTF-8, the most common text encoding on the web, writes each character in 1 to 4 bytes: the letter A is one byte, 01000001; the Cyrillic Я is two bytes, D0 AF; € is three; most emoji are four. Negative whole numbers are usually stored in two's complement.

Questions about binary

How do you convert decimal to binary?

Divide the number by 2 again and again until the quotient is 0, writing down each remainder. Read the remainders from the bottom up: 11 gives 1, 1, 0, 1, so 11₁₀ = 1011₂. The converter writes this table for any number.

How do you translate text to binary?

Each character is turned into bytes by an encoding, usually UTF-8, and each byte is written as eight bits. Hi becomes 01001000 01101001. Letters outside the Latin alphabet take more than one byte, which the character table shows.

Why does 0.1 never end in binary?

Only fractions whose denominator is a power of 2 end in binary. 0.1 is 1/10, and 10 has the factor 5, so the binary digits repeat forever: 0.0(0011)₂. This is also why 0.1 + 0.2 is not exactly 0.3 in most programming languages.

What is two's complement?

It is the usual way to store negative whole numbers in a fixed number of bits: write the absolute value in binary, invert every bit and add 1. In 8 bits −5 is 11111011, and the range is from −128 to 127.

Sources

  1. Binary number — Wikipedia
  2. Two's complement — Wikipedia
  3. RFC 3629: UTF-8, a transformation format of ISO 10646

Related guides

More tools

Codes and ciphers