Compiler vs Interpreter — What's the Difference?

A compiler translates entire source code into another form (often machine code) before execution begins; an interpreter reads and executes source code directly, line by line, at runtime.

Published October 3, 2026

A compiler translates entire source code into another form (often machine code) before execution begins; an interpreter reads and executes source code directly, line by line, at runtime.

Why they differ

  • Compiled code generally runs faster since translation work happens once, ahead of time, rather than repeatedly during execution
  • Interpreted code can start running immediately without a separate build step, and often gives more flexibility for dynamic behavior

How to choose

  • Languages like C and Rust are traditionally compiled ahead of time for maximum runtime performance
  • Languages like Python and Ruby are traditionally interpreted for faster iteration during development

FAQ

Is JavaScript compiled or interpreted?

Modern JavaScript engines like V8 use a hybrid approach called JIT (just-in-time) compilation — code starts out interpreted and hot code paths get compiled to machine code while running.

More General articles