Skip to content
Technology

What is A compiler?

A compiler is a program that translates code written by humans into machine code a computer can run directly. It takes a whole program written in a language like C or Java and converts it into fast, executable instructions.

See it, don’t just read it.
Watch a 2-minute lesson with voice + animation that explains a compiler.
▶ Watch the visual lesson

Key things to understand

  • 1It translates human-written code into machine code.
  • 2It processes the whole program before running.
  • 3Compiled programs tend to run fast.
  • 4It contrasts with interpreters, which run code line by line.

Frequently asked questions

What does a compiler do?
It translates source code written by programmers into machine code the computer can execute directly.
What's the difference between a compiler and an interpreter?
A compiler translates the whole program ahead of time; an interpreter runs it line by line as it goes.
Why are compiled programs fast?
They're already translated into low-level machine instructions, so the computer runs them directly.

Related topics