Como converter texto para binario e vice-versa

8 min de leitura

Aprenda como funciona a conversao texto-binario e converta gratis.

What is binary and why computers use it

The binary system uses only 0 and 1. Computers use it because circuits have two states: on (1) and off (0). Everything — text, images, video — is sequences of 0s and 1s.

Example: "A" = 65 in ASCII = 01000001 in binary. "Hi" = 01001000 01101001.

Common sizes: 1 bit = 2 values. 1 byte = 8 bits = 256 values. 1 KB ≈ 1,000 characters.

Convert with the NexTools text-binary converter.

How text to binary conversion works

Step 1: Each character has a number in a character encoding table (ASCII, UTF-8).

Step 2: That number is converted to base 2 (binary).

CharASCIIBinary
H7201001000
e10101100101
l10801101100
o11101101111

The NexTools converter does this instantly in both directions.

ASCII vs UTF-8: text encodings

ASCII (1963): 128 characters (7 bits). English only.

UTF-8 (1993): Modern standard. ALL characters from ALL languages + emojis. Compatible with ASCII.

English: 1 byte. Accents: 2 bytes. CJK: 3 bytes. Emojis: 4 bytes.

For other encoding methods, see our Base64 guide.

Practical uses of text-binary conversion

1. Education: Understanding computer internals.

2. Debugging: Encoding bugs (mojibake).

3. Secret messages: Binary is unreadable at a glance.

4. Networking: Data transmits as bit sequences.

5. Compression: Huffman coding uses fewer bits for frequent characters.

For hashing, use the NexTools hash generator.

Number systems: binary, octal, decimal, hexadecimal

SystemBaseDigitsExample (65)Use
Binary20-11000001Circuits, bits
Octal80-7101Unix permissions
Decimal100-965Human daily use
Hex160-F41CSS colors, memory

Convert hex colors with the NexTools color converter.

How to manually convert binary to text

Step 1: Split binary into 8-bit groups (bytes).

Step 2: Convert each to decimal: 01001000 = 72.

Step 3: Look up in ASCII table: 72 = "H".

Shortcut: Memorize powers of 2: 128, 64, 32, 16, 8, 4, 2, 1. Each "1" bit adds its power.

Or paste in the NexTools converter for instant results.

Conversion in code: JavaScript and Python

JS text→binary:

"Hello".split('').map(c => c.charCodeAt(0).toString(2).padStart(8,'0')).join(' ')

JS binary→text:

"01001000 01101001".split(' ').map(b => String.fromCharCode(parseInt(b,2))).join('')

Python text→binary:

' '.join(format(ord(c),'08b') for c in "Hello")

Python binary→text:

''.join(chr(int(b,2)) for b in "01001000 01101001".split())

Fun facts about binary

First binary computer: Konrad Zuse's Z1 (1938).

Why not ternary (base 3)? Ternary computers were researched (Setun, USSR, 1958). Theoretically more efficient but harder to build.

Is Morse code binary? Almost. Dots and dashes ≈ 0 and 1. But pauses of different lengths make it technically multi-state.

Programmer joke: "There are 10 types of people: those who understand binary and those who don't." (10 in binary = 2 in decimal.)

Experimente esta ferramenta:

Abrir ferramenta

Perguntas frequentes

How do you convert a letter to binary

Each letter has a number in ASCII/UTF-8. 'A' = 65 = 01000001. Convert by dividing by 2 repeatedly and noting remainders.

How many bits to represent a character

Basic ASCII: 7 bits. One byte (8 bits): 256 characters. UTF-8: 1-4 bytes. English = 1, accents = 2, CJK = 3, emojis = 4.

What's the difference between ASCII and UTF-8

ASCII: 128 characters (basic English). UTF-8: all world characters (1,114,112 possible). UTF-8 is backwards-compatible with ASCII.

Can any language be written in binary

Yes, using UTF-8. Every character (Chinese, Arabic, Hindi, emojis) has a binary UTF-8 representation. Only the byte count changes (1-4 per character).

Does the NexTools converter work with emojis

Yes. Supports UTF-8 including emojis, CJK, accents, special symbols. Emojis use 4 bytes (32 bits) each.

What's the real-world use of text-to-binary conversion

Education (understanding computers), debugging encoding issues, networking (packet analysis), basic cryptography, and as curiosity/game (binary 'secret' messages).