How exactly computers work, and what exactly computer code is. I’ve been trying to wrap my head around how they work and what the applications on them actually do. Additionally, how do websites work?


How exactly computers work, and what exactly computer code is. I’ve been trying to wrap my head around how they work and what the applications on them actually do. Additionally, how do websites work?

In: Technology

The real question is how the hell do magnets work? And blankets??

Computers operate on the most basic level by using binary code. Basically 1 means in and 0 means off. This is extremely simplified but essentially what happens, as each 1 and 0 switches on or off a specific parameter or electrical “gateway” so to speak inside the computer circuit board.

Over the years we have built over this binary code to make things easier to not only build but understand. It’s almost like instead of saying 1+1+1+1+1+1=6 we have built it up where computers can now understand 3+3=6. Another analogy would be instead of using a whole paragraph of Latin to describe that one flower is purple in small clusters with tiny leaves in many quantity, we can now just input “lavender bush” and it will be understood.

This is a very rudimentary explanation but I tried to make it as simple as possible. Remember the first computers were operated by cards that either had a whole punched or not punched to tell them how to operate.

At a very, very basic level, computers are machines made up of electricity and switches – think light switches. These switches can be in the “off” position or the “on” position. The more switches there are, the more combinations there can be (e.g. “on, off, on” vs “off, off, on”). In computer terms, we can have these positions be represented by numbers (binary – 0 and 1). From there, we can start linking switches together to create [logic gates]( Then, you can link together logic gates to allow for more complex data to be calculated.

The switches are used to control the behavior of the computer via code. Most modern code is abstracted away from controlling the switches directly and instead uses more user-friendly, easy to understand language and terms. So, it ends up looking less like “supply electricity to switches 1-2” and more like “set apples = 3.”

Applications are layers upon layers of code that all work together to perform functions for the user. Want to enter your name into a field? Well, that field is going to be backed by code giving it the appearance of a place to type something in and more code giving it the ability to take what you type and save it somewhere else.

Websites are the same thing, they just don’t “live” on your computer. When you go to a website, you’re “visiting” an application that exists on another computer somewhere.

For a far better (but longer) explanation of computers, I highly recommend checking out the [crash course youtube series on computer science.](

Short answer: magic. Longer answer: layers of abstraction. Lets start at transistors because they are easy to research and how they are made is not important to understand computers.

With transistors you can make not, nor, nand circuits. They are basic building blocks of every logic operation. With them you create flip flops (memory), adders, multiplyers, etc. With these circuits you can make ALUs (arithmetic logic units) basicaly calculators. Add some circuits for specific tasks and you have CPU. With CPU and some storage option you have a computer, that is where computer code comes in.

Computer code in its lowest form (machine code/assembler) tells cpu what to calculate, some other stuff like shifting values but mostly calculating. The further you go from assembler the more layers of abstraction there are. Eg c has few layers (often one), python or javascript have many layers (python was first writen in c and later they started using already writen stuff to write even more and more). When you write code you dont need to think how will CPU understand what you wrote, you have programs that are there to make it understand.

What applications do depends on application. In general they help user to achieve a goal. Eg excel to calculate some spreadsheets or email client to send a message to another user.

Today websites are very complex beasts and understanding how they work is best left to trained monkeys, errrr I mean developers. In their simplest form they have a server and user. Server is computer that houses the website, think a lemonade stand. A user is a customer, think a thirsty developer. When a thirsty developer wants lemonade he goes to lemonade stand and asks for a glass of sweet nectar of gods. The server gives it to him and he uses his mouth(web browser) to convert lemonade to a form usable to his body.

This field is very complex like any other, so it is best not to ask questions with words exactly when asking general questions. Noone can tell you how computer works exactly because to understand how they work EXACTLY you need to know physics of electricity, semiconductors, signal propagation, etc. And metric ton of math. My sugestion is to research how to ask a good question and figure out what you realy want to know because I highly doubt that these answers truly answered that.

I’ll pile on to what’s been said with a different answer that hopefully gives a more high level understanding.

A computer works by doing something ridiculously basic, but adds layer after layer of complexity as it gets closer and closer to a person interacting with it.

Computers are very complex, as many have said, but they didn’t start out that way. Over the years, they have added more and more layers to the point where today, most everything you do as a computer user goes through dozens of these layers.

The lowest layer is the binary code which has already been explained. That’s the really basic stuff the computer can deal with extremely efficiently. But while binary code might be “easy” for a computer to work with, it’s actually super tedious and not at all straightforward for anyone who isn’t proficient in it. All these layers are needed to make it easy for a person to do something with it.

Let’s start at the highest layer now and work our way down. I won’t explain these things in any detail, but it’ll give you an idea of how the layers work together to go from user-friendliness to binary code.

So, at the top, we have…

The Application/Program/App – that’s what you are using now. It’s the web browser, phone app, or program on your PC.

These apps are created by programmers who utilize the next layer, which has many names, but let’s call it a software library. This is like a toolbox that they can use to piece together different pieces of functionality into a single app.

That library is built on lots and lots of smaller libraries

Those smaller libraries are built by other programmers who know how to expose different parts of the computer’s operating system (yet another layer down the chain) to programmers.

The operating system (OS) exposes its functionality to programmers in the layer above. At this level, the programmers are able to do stuff with loading/saving files, network transmission, displaying stuff to the screen, playing sound through the speakers, etc…

Inside the OS, each of these areas of functionality is programmed by talking to the next layer down which knows how to work with each of the computer’s hardware components (things like the hard drive, flash card, display/screen, mouse, keyboard, network card, etc..) These things are called ‘drivers’

The drivers are programmed to talk directly to the hardware that they are designed for.

Below the drivers, you have the actual hardware like the screen, the disk drive, the printer, etc..

In the case of the screen, the driver that knows how to talk to the screen hardware (which includes the video card and the monitor) is the display driver.

This does a bunch of stuff, but if you start at the highest layer, and work your way down to this point, you can maybe see how an app programmer might be able to get something to display on the screen. All of those layers in between make that possible.

This is so very oversimplified, but I took the question to mean more about how does everything fit together rather than super amounts of detail on how it all works.

Anyway, if there’s one topic that has enormous amounts of coverage on YouTube, then this one is it. You should be able to find more detail there.