Bytecode is a set of instructions designed to be run by a virtual machine, a software-defined computer, rather than directly by a physical processor. It sits between human-readable source code and the native machine code of a particular CPU, giving a single compiled program a portable form that many different computers can execute.
The clearest example is Java. Oracle’s Java tutorial explains that a compiled class file “does not contain code that is native to your processor; it instead contains bytecodes, the machine language of the Java Virtual Machine.” The Java Virtual Machine Specification describes the same idea from the runtime’s side: a class file “contains Java Virtual Machine instructions (or bytecodes) and a symbol table,” and the virtual machine “knows nothing of the Java programming language, only of a particular binary format, the class file format.”
The advantage of this approach is portability and size. Because the bytecode targets an abstract machine instead of a specific chip, the tutorial notes that “the same .class files are capable of running on Microsoft Windows, the Solaris Operating System, Linux, or Mac OS.” Compile once, and any machine that supplies the matching virtual machine can run the result.
Bytecode is not unique to Java. Python compiles its source into its own bytecode that a Python virtual machine then executes, and many other language systems use the same general technique. In each case bytecode is the portable middle layer that lets one compiled program run on very different hardware.