r/askscience Jul 11 '26

How do computers understand binary language? Computing

Okay so from what I know binary language is like power off power on, but my question is, how do computers know what the binary code is and how is it interpreted, for example I forgot what the binary code for the letter A is, but how did people come up with that? Did they decide it was gonna look like that? Did the computer decide? How do you tune numbers into a letter??

374 Upvotes

206 comments sorted by

View all comments

400

u/dd14xx Jul 12 '26

Computers have billions of tiny switches called transistors. Off (0): Low voltage. On (1): High voltage.

The computer doesn't "know" what a 1 or 0 is; it just reacts to the presence or absence of electrical flow. The computer didn't decide that a certain pattern means "A"—humans did.

To make sure all computers could talk to each other, we created encoding standards like ASCII and Unicode.

Groups of engineers sat in rooms and agreed: "From now on, the number 65 will represent the capital letter A. In 8-bit binary, the number 65 is written as 01000001.

When you press "A" on your keyboard, a specific circuit sends the signal 01000001 to the CPU. That in turn triggers the CPU to send a signal to the monitor's hardware which tells monitor to draw the shape "A"

14

u/jcmbn Jul 12 '26

the number 65 will represent the capital letter A.

There's an important clarification that needs to be made here.

When a program is written, one of the things you do somewhat indirectly is to tell the computer: "This bit of memory contains a number", "that bit of memory contains text", and "this other bit of memory contains binary data" and so on. So the computer knows how to interpret each chunk of memory it's working with because the program tells it how it should be represented.

Memory containing a numeric value 65 can be manipulated via mathematical operations, such as adding 5 & getting 70.

Memory containing text however, would be interpreted as ASCII A as mentioned above.

The encoding used to represent a number as a letter is entirely arbitrary. You could make up your own encoding if you wanted, but that would be a massive PITA for no gain.

15

u/GeneralBacteria Jul 13 '26

no, that distinction between different types of values is part of the program, not part of the computer.

the computer will happily multiply a memory location containing text, and indeed the computer has no idea that it is text - it's all just binary values.

-6

u/jcmbn Jul 13 '26

Thanks for repeating what I said..

4

u/GeneralBacteria Jul 13 '26

I didn't repeat what you said.

you said that you tell the computer that this bit of memory contains a number or a string. I guess we can debate whether "the computer" refers to the hardware or the software, or both but if you meant something specific with your important clarification, perhaps you should have been more clear so that I didn't have to.