# Bytecode

> A halfway form of code. A virtual machine runs it on any computer.

**Field:** Software Development  
**Category:** Compilers & Runtimes  
**Also known as:** Byte Code, Intermediate Code

## Think of it like

Think of it like sheet music. It is not the sound yet, but any player who reads music can play it.

## Definition

Bytecode is a halfway form of code, made to sit between source code and machine code. A compiler turns source code into bytecode, and then a virtual machine runs it. The same bytecode runs on any computer that has that machine. Java turns code into bytecode for the JVM. Python makes it too, out of sight, each time it runs a file.

## Example

A team builds one Java file of bytecode. The same file runs on their Windows laptops and their Linux servers.

## Example code

```console
$ python3 -m dis add.py
  ...
  LOAD_FAST_BORROW_LOAD_FAST_BORROW 1 (a, b)
  BINARY_OP                0 (+)
  RETURN_VALUE
```

Python 3.14 turns return a + b into three bytecode steps.

## Why it matters

Java, C# and Python all use it. That is how one program runs on many kinds of machine.

## Common mistake

Thinking bytecode is machine code. The chip cannot run it; a virtual machine has to read it.

## Three principles

- **Halfway step.** Between source code and machine code.
- **Needs a VM.** A virtual machine runs it.
- **Runs anywhere.** One file works on many machines.

## Related terms

- [Machine Code](https://learn.benibix.com/term/development/machine-code)
- [Compiler](https://learn.benibix.com/term/development/compiler)
- [Interpreter](https://learn.benibix.com/term/development/interpreter)
- [Java](https://learn.benibix.com/term/development/java)
- [Java Virtual Machine (JVM)](https://learn.benibix.com/term/development/java-virtual-machine)
- [Common Language Runtime (CLR)](https://learn.benibix.com/term/development/common-language-runtime)

## Told apart from

- [Bytecode vs Machine Code](https://learn.benibix.com/compare/bytecode-vs-machine-code): People think bytecode is machine code, and it is not. Machine code is the steps a chip runs directly, so it only works on one chip family. Bytecode is a list of simpler steps for a virtual machine, which a program reads and runs. That makes it work on any chip that has the virtual machine. Python, Java and C# all make bytecode first.

---

Source: https://learn.benibix.com/term/development/bytecode
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
