Input (expression and assignment)
total = price * qty + taxThe Python Bytecode Viewer shows the instructions CPython compiles your code to. Paste or write Python, press Disassemble, and the source is compiled with real CPython 3.14 and taken apart with the standard dis module. Every code object gets its own section: the module, each function, each class body and each lambda. Click an instruction to jump to the source line that produced it, or put the cursor on a line to see its instructions highlighted. A dis text view gives you the exact output of dis.dis() to copy or download.
CPython does not run Python source directly. It first compiles it into bytecode, a list of simple stack-machine instructions such as LOAD_NAME, BINARY_OP and RETURN_VALUE, and its interpreter loop runs those. Reading bytecode shows what a line really costs, why one way of writing something beats another, how comprehensions, f-strings and pattern matching are put together, and what changed between Python versions. The format is an implementation detail and changes with every minor release, so this viewer names the exact version it compiled with.
The main file is the entry point for each run.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
total = price * qty + tax 0 RESUME 0
1 LOAD_NAME 0 (price)
LOAD_NAME 1 (qty)
BINARY_OP 5 (*)
LOAD_NAME 2 (tax)
BINARY_OP 0 (+)
STORE_NAME 3 (total)
LOAD_CONST 0 (None)
RETURN_VALUEdef add(a, b):
return a + b 0 RESUME 0
1 LOAD_CONST 0 (<code object add at 0x749defa6d3e0, file "<input>", line 1>)
MAKE_FUNCTION
STORE_NAME 0 (add)
LOAD_CONST 1 (None)
RETURN_VALUE
Disassembly of <code object add at 0x749defa6d3e0, file "<input>", line 1>:
1 RESUME 0
2 LOAD_FAST_BORROW_LOAD_FAST_BORROW 1 (a, b)
BINARY_OP 0 (+)
RETURN_VALUEif n > 0:
sign = 1
else:
sign = -1 0 RESUME 0
1 LOAD_NAME 0 (n)
LOAD_SMALL_INT 0
COMPARE_OP 148 (bool(>))
POP_JUMP_IF_FALSE 5 (to L1)
NOT_TAKEN
2 LOAD_SMALL_INT 1
STORE_NAME 1 (sign)
LOAD_CONST 1 (None)
RETURN_VALUE
4 L1: LOAD_CONST 2 (-1)
STORE_NAME 1 (sign)
LOAD_CONST 1 (None)
RETURN_VALUEfor item in items:
print(item) 0 RESUME 0
1 LOAD_NAME 0 (items)
GET_ITER
L1: FOR_ITER 11 (to L2)
STORE_NAME 1 (item)
2 LOAD_NAME 2 (print)
PUSH_NULL
LOAD_NAME 1 (item)
CALL 1
POP_TOP
JUMP_BACKWARD 13 (to L1)
1 L2: END_FOR
POP_ITER
LOAD_CONST 0 (None)
RETURN_VALUEmsg = f"Hello, {name}!" 0 RESUME 0
1 LOAD_CONST 0 ('Hello, ')
LOAD_NAME 0 (name)
FORMAT_SIMPLE
LOAD_CONST 1 ('!')
BUILD_STRING 3
STORE_NAME 1 (msg)
LOAD_CONST 2 (None)
RETURN_VALUEsquares = [x * x for x in nums] 0 RESUME 0
1 LOAD_NAME 0 (nums)
GET_ITER
LOAD_FAST_AND_CLEAR 0 (x)
SWAP 2
L1: BUILD_LIST 0
SWAP 2
L2: FOR_ITER 11 (to L3)
STORE_FAST_LOAD_FAST 0 (x, x)
LOAD_FAST_BORROW 0 (x)
BINARY_OP 5 (*)
LIST_APPEND 2
JUMP_BACKWARD 13 (to L2)
L3: END_FOR
POP_ITER
L4: SWAP 2
STORE_FAST 0 (x)
STORE_NAME 1 (squares)
LOAD_CONST 0 (None)
RETURN_VALUE
-- L5: SWAP 2
POP_TOP
1 SWAP 2
STORE_FAST 0 (x)
RERAISE 0
ExceptionTable:
L1 to L4 -> L5 [2]assert x > 0, "x must be positive" 0 RESUME 0
1 LOAD_NAME 0 (x)
LOAD_SMALL_INT 0
COMPARE_OP 148 (bool(>))
POP_JUMP_IF_TRUE 8 (to L1)
NOT_TAKEN
LOAD_COMMON_CONSTANT 0 (AssertionError)
LOAD_CONST 1 ('x must be positive')
CALL 0
RAISE_VARARGS 1
L1: LOAD_CONST 2 (None)
RETURN_VALUEassert x > 0, "x must be positive" RESUME 0
LOAD_CONST 0 (None)
RETURN_VALUEThe editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Press Disassemble (or Ctrl / ⌘ + Enter) to compile your source with CPython 3.14
The source is compiled with compile() and disassembled with dis; it is never executed
Each code object (module, function, class, lambda) gets its own section
Click an instruction to jump to the line that produced it
Put the cursor on a line to highlight its instructions
Syntax errors and compile warnings are marked in the editor
Table shows offsets, jump labels and arguments; dis text is the exact dis.dis() output
Optimize -O strips asserts and -OO also strips docstrings, like the python flags
Copy or download the dis text as bytecode.txt
Source up to 64 KB; the table lists up to 3,000 instructions
One compile per click; nothing runs while you type
Press Disassemble to see the bytecode CPython compiles your code to
The Python Bytecode Viewer shows the instructions CPython compiles your code to. Paste or write Python, press Disassemble, and the source is compiled with real CPython 3.14 and taken apart with the standard dis module. Every code object gets its own section: the module, each function, each class body and each lambda. Click an instruction to jump to the source line that produced it, or put the cursor on a line to see its instructions highlighted. A dis text view gives you the exact output of dis.dis() to copy or download.
CPython does not run Python source directly. It first compiles it into bytecode, a list of simple stack-machine instructions such as LOAD_NAME, BINARY_OP and RETURN_VALUE, and its interpreter loop runs those. Reading bytecode shows what a line really costs, why one way of writing something beats another, how comprehensions, f-strings and pattern matching are put together, and what changed between Python versions. The format is an implementation detail and changes with every minor release, so this viewer names the exact version it compiled with.
The main file is the entry point for each run.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
total = price * qty + tax 0 RESUME 0
1 LOAD_NAME 0 (price)
LOAD_NAME 1 (qty)
BINARY_OP 5 (*)
LOAD_NAME 2 (tax)
BINARY_OP 0 (+)
STORE_NAME 3 (total)
LOAD_CONST 0 (None)
RETURN_VALUEdef add(a, b):
return a + b 0 RESUME 0
1 LOAD_CONST 0 (<code object add at 0x749defa6d3e0, file "<input>", line 1>)
MAKE_FUNCTION
STORE_NAME 0 (add)
LOAD_CONST 1 (None)
RETURN_VALUE
Disassembly of <code object add at 0x749defa6d3e0, file "<input>", line 1>:
1 RESUME 0
2 LOAD_FAST_BORROW_LOAD_FAST_BORROW 1 (a, b)
BINARY_OP 0 (+)
RETURN_VALUEif n > 0:
sign = 1
else:
sign = -1 0 RESUME 0
1 LOAD_NAME 0 (n)
LOAD_SMALL_INT 0
COMPARE_OP 148 (bool(>))
POP_JUMP_IF_FALSE 5 (to L1)
NOT_TAKEN
2 LOAD_SMALL_INT 1
STORE_NAME 1 (sign)
LOAD_CONST 1 (None)
RETURN_VALUE
4 L1: LOAD_CONST 2 (-1)
STORE_NAME 1 (sign)
LOAD_CONST 1 (None)
RETURN_VALUEfor item in items:
print(item) 0 RESUME 0
1 LOAD_NAME 0 (items)
GET_ITER
L1: FOR_ITER 11 (to L2)
STORE_NAME 1 (item)
2 LOAD_NAME 2 (print)
PUSH_NULL
LOAD_NAME 1 (item)
CALL 1
POP_TOP
JUMP_BACKWARD 13 (to L1)
1 L2: END_FOR
POP_ITER
LOAD_CONST 0 (None)
RETURN_VALUEmsg = f"Hello, {name}!" 0 RESUME 0
1 LOAD_CONST 0 ('Hello, ')
LOAD_NAME 0 (name)
FORMAT_SIMPLE
LOAD_CONST 1 ('!')
BUILD_STRING 3
STORE_NAME 1 (msg)
LOAD_CONST 2 (None)
RETURN_VALUEsquares = [x * x for x in nums] 0 RESUME 0
1 LOAD_NAME 0 (nums)
GET_ITER
LOAD_FAST_AND_CLEAR 0 (x)
SWAP 2
L1: BUILD_LIST 0
SWAP 2
L2: FOR_ITER 11 (to L3)
STORE_FAST_LOAD_FAST 0 (x, x)
LOAD_FAST_BORROW 0 (x)
BINARY_OP 5 (*)
LIST_APPEND 2
JUMP_BACKWARD 13 (to L2)
L3: END_FOR
POP_ITER
L4: SWAP 2
STORE_FAST 0 (x)
STORE_NAME 1 (squares)
LOAD_CONST 0 (None)
RETURN_VALUE
-- L5: SWAP 2
POP_TOP
1 SWAP 2
STORE_FAST 0 (x)
RERAISE 0
ExceptionTable:
L1 to L4 -> L5 [2]assert x > 0, "x must be positive" 0 RESUME 0
1 LOAD_NAME 0 (x)
LOAD_SMALL_INT 0
COMPARE_OP 148 (bool(>))
POP_JUMP_IF_TRUE 8 (to L1)
NOT_TAKEN
LOAD_COMMON_CONSTANT 0 (AssertionError)
LOAD_CONST 1 ('x must be positive')
CALL 0
RAISE_VARARGS 1
L1: LOAD_CONST 2 (None)
RETURN_VALUEassert x > 0, "x must be positive" RESUME 0
LOAD_CONST 0 (None)
RETURN_VALUEThe editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Press Disassemble (or Ctrl / ⌘ + Enter) to compile your source with CPython 3.14
The source is compiled with compile() and disassembled with dis; it is never executed
Each code object (module, function, class, lambda) gets its own section
Click an instruction to jump to the line that produced it
Put the cursor on a line to highlight its instructions
Syntax errors and compile warnings are marked in the editor
Table shows offsets, jump labels and arguments; dis text is the exact dis.dis() output
Optimize -O strips asserts and -OO also strips docstrings, like the python flags
Copy or download the dis text as bytecode.txt
Source up to 64 KB; the table lists up to 3,000 instructions
One compile per click; nothing runs while you type
Press Disassemble to see the bytecode CPython compiles your code to