If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Central Processing Unit (CPU)

The CPU is the brain of a computer, containing all the circuitry needed to process input, store data, and output results.
The CPU is constantly following instructions of computer programs that tell it which data to process and how to process it. Without a CPU, we could not run programs on a computer.
For example, a simple calculator program might instruct the CPU to take two numbers, 2 and 2, add them, and send back the result.
An illustration of a CPU. The CPU is shown as a tall rectangle with silver pins coming out of the left and right sides. An arrow flows from the left with binary numbers and arrow flows to the right with more binary.
The CPU can process those instructions easily, thanks to a control unit that knows how to interpret program instructions and an Arithmetic Logic Unit (ALU) that knows how to add numbers. With the control unit and ALU combined, the CPU can process much more complex programs than a simple calculator.

Inside the CPU

At the hardware level, a CPU is an integrated circuit, also known as a chip. An integrated circuit "integrates" millions or billions of tiny electrical parts, arranging them into circuits and fitting them all into a compact box.
Photo of an Intel chip, covered in gold and wires.
An Intel 80486DX2 CPU chip. Source: Matt Gibbs, Wikipedia Commons
We can visualize the layers of the CPU chip:
Four labeled illustrations of computer parts, stacked from top to bottom. At the top is a chip, then a logic circuit, then a logic gate, and then a transistor and wire.
Some of those layers are physical devices, like the chip and transistors, and some of those layers are abstractions, like logic circuits and gates.
It's impressive that we can put together seemingly simple devices like logic gates to create CPUs that power complex devices like our phones, computers, and even self-driving cars.

🙋🏽🙋🏻‍♀️🙋🏿‍♂️Do you have any questions about this topic? We'd love to answer— just ask in the questions area below!

Want to join the conversation?

  • winston default style avatar for user F H
    what are the differences between GPU and CPU?
    (6 votes)
    Default Khan Academy avatar avatar for user
    • primosaur ultimate style avatar for user Christian Jahnel
      The GPU or Graphics Processing Unit is specialized to crunch numbers efficiently to output smooth graphics from something like a video game. The CPU can basically do anything but since the architecture of the GPU is more efficient for rendering graphics it hands the workload to the GPU. Both are types of microprocessers that handle different tasks. The GPU is generally divided up into many cores whereas the CPU is only split into a few cores. GPUs are also used for mining cryptocurrencies since they can crunch numbers so quickly. Hope this helps.
      (18 votes)
  • duskpin ultimate style avatar for user Júlia Coelho
    Can the CPU actually store data? My very generic google surch tells me it stores only the data necessary forr the current operation, but that seems awfully close to the description of the RAM-Memory in the following class. So the CPU only processes it and stores it in RAM-Memory or does the CPU store the data too?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Mahin Miah
    Hey guys,

    I'm really curios to know how the control unit - which knows how to interpret program instructions - and the Arithmetic Logic Unit (ALU), which knows how to add the numbers in this lessons diagram, work?

    Like how does the circuitry in the CPU know how to execute these instructions?

    Thanks!
    (1 vote)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user gevorg.petrosyan
    What is the special memory used only by the CPU?
    Where is it located?
    What are the different types of this special memory?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Nick Knowles
      What is the special memory used only by the CPU?
      A: Registers (collectively referred to as L1 Cache)

      Where is it located?
      A: On the chip, next to the ALU

      What are the different types of this special memory?
      A: Types of registers included will vary by processor, but usually some combination of
      - Acumulator (ACC): stores data for all ALU operations
      - Program Counter (PC): stores address of next instruction
      - Instruction Register (IR): stores instruction
      - Data Register (DR): stores data
      - Address Register (AR): hold addresses to primary memory
      - Temporary Register (TR): stores temporary data
      - I/O Register (INTR / OUTR): stores input and output data

      Sets of registers work together to facilitate the most basic units of computation that take place in a computer. The size of a register can be 8, 16, 32, or 64 bits. The registers in a 32 bit computer are 32 bits wide, for example.

      Each CPU (logical core) gets its own set of registers. The term "Virtual Cores" or "Threads" stems from the idea of including multiple (independent) sets of registers for each physical CPU (core). eg; "8 cores 16 threads" == 8 CPUs and 16 sets of registers (2 per core).

      You can use tools like GDB to inspect and manipulate the registers while a program is running. This can be useful for debugging or exploiting computer software.
      (5 votes)
  • ohnoes default style avatar for user sallejc
    him is me and me is him
    (4 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user moyoladipo
    The C.P.U takes in binary numbers which are placed in 1s and 0s. How does the computer take it in as what we called binary number system? does it change it or it is represented in binary inside the computer?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Martin
      The computer takes in currents of electricity, 1 and 0 are already an abstraction. In the CPU transistors are manipulated to make the CPU do what it does.

      There should be more about that in the following sections or you can search "PBS Crash Course Computer Science #1" produced by the PBS which goes a little bit more into depth.
      (4 votes)
  • blobby green style avatar for user Rohit
    Does logical processors or physical processors decides if a cpu is a dual, quad or octa core processor?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • starky seedling style avatar for user lmn32
      Given that a "Logical processor" or a "logical core" is the number of threads/core * how many physical cores you have, having a 'Intel i7 1135-H', which has '4 cores' * '8 threads', would give you 32 "logical cores"*. By a 4 core processor, we refer to number of *physical cores!
      (1 vote)
  • leaf grey style avatar for user codetime
    From what I understand the CPU processes the info "flowing through" the computer. what type of information is it processing though. like is it just taking in data and deciding weather to run it or not because I thought programs were stored in code written by programmers. Not actually sure what my question was and im starting to understand what their supposed to be doing as im writing this but anyway is there anywhere I can go to get a more in depth explanation.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user gabriel.adkins
    so if i had a cpu how much would i buy it for
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user David Okosa
    Why is CPU called the brain of the computer?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • starky seedling style avatar for user lmn32
      If you think about what a computer really is, you realized that there's essentially 2 jobs that all computer systems must accomplish:


      1. Direct the processing of information (take input from a keyboard, combine it with values from a hard drive, and then spew it out into a printer or graphics card)

      2. Physically preform the processing (ex: move data, combine pieces of information/data together logically, arithmetically add pieces of data together etc.)



      You can think of the CPU as a "brain", because it controls how data flows throughout the entire computer system , under the influence of instructions, which are called "programs"!

      In this analogy, you can think of "software" as your personality, or just "you" psychologically speaking. The electrons, transistors, digital logic gates, and instruction set architecture are your blood, bones, tissues, and organs respectively.

      The CPU(your brain) dictates how these organs function together as a system("ex: as your body"), while also regulating each individual subsystem using code as hormones!
      (1 vote)