Free Online Assembly Compiler & 8086 Simulator

Quick answer

Write 8086 assembly in your browser, press Run, and watch real registers, flags and memory change. This online assembly compiler needs no install, no signup and nothing uploaded. Step through programs one instruction at a time, or start with the built-in tutorial and practice exercises below.

Last updated: October 17, 2026

Assembly is the best way to understand what a processor actually does, and the usual setup fights you the whole way: DOSBox, MASM installers and editor configs before your first MOV. This page skips all of that. You get an editor, an assembler and a CPU simulator in one tab, plus registers, flags and memory you can watch change as the program runs. Press Run for the whole program, or Step to walk through it one instruction at a time and see exactly what each line does.

Use the tool below
Examples
Loading editor…

RegistersIP 0100

AX 0000 0AH 00 · AL 00
BX 0000 0BH 00 · BL 00
CX 0000 0CH 00 · CL 00
DX 0000 0DH 00 · DL 00
SI 0000 0
DI 0000 0
BP 0000 0
SP FFFE 65534
ZFSFCFOF0 instructions

Output

Output appears here. Press Run, or Step through one instruction at a time.

Real registers, real flags, real single-stepping. Your code is assembled and run in this tab; nothing is sent anywhere.

Programs that read with AH=01h take characters from here.

Memorybytes · hex

010000 00 00 00 00 00 00 00|········|
010800 00 00 00 00 00 00 00|········|
011000 00 00 00 00 00 00 00|········|
011800 00 00 00 00 00 00 00|········|

Assembly Compiler Online runs entirely in your browser, nothing you paste or type is uploaded to any server, and no account is needed.

Learn assembly here, from zero

Everything below lives on this page on purpose. Read a section, scroll up, press Step, and watch the registers do what the text just described. Ten minutes of that beats an hour of reading, and nothing here needs an install or an account.

Your first program, line by line

This is the example waiting in the editor. It prints a string and stops. The comments tell you what each line does; here is the why.

ORG 0100h            ; programs load at address 0100h here

    MOV DX, msg      ; put the ADDRESS of the text in DX
    MOV AH, 09h      ; pick DOS service 09h: "print a string"
    INT 21h          ; hand control to DOS (the simulator)

    MOV AH, 4Ch      ; pick service 4Ch: "end the program"
    INT 21h

msg DB "Hello, World!$"   ; the bytes of the text, $ ends it

Two ideas carry the whole program. First, DX does not hold the text itself, it holds where the text lives, which is why msg can sit at the bottom of the file. Second, INT 21h is a service desk: the number in AH chooses the service, DX or DL passes any extra information, and the call does the work. Press Step on this program and watch AX, DX and IP change line by line.

Meet the registers

A register is a tiny storage box inside the processor, and assembly is mostly moving numbers between boxes. Each 16-bit register splits into two 8-bit halves, so AX contains AH (high half) and AL (low half). The register panel shows both halves at all times.

  • AXthe arithmetic register. division and multiplication use it automatically, and its AL half receives characters from input.
  • BXa general workhorse, often used to hold addresses.
  • CXthe counting register. LOOP counts it down automatically, so loops live here.
  • DXdata mover. string printing expects a string's address here, and DL carries single characters out.
  • SI, DIsource and destination pointers for walking through strings.
  • SP, BPstack bookkeeping. CALL and PUSH/POP use SP without you touching it.

The instructions worth memorizing first

Twelve lines of vocabulary cover most beginner programs. The full list the simulator accepts is longer, but these are the ones the exercises use.

MOV AX, 5copies 5 into AX. The destination comes first.
ADD AX, BX / SUB AX, BXarithmetic. CMP works the same way but only sets flags, it keeps no result.
INC CX / DEC CXadd or subtract one. (Quirk worth knowing: INC and DEC leave the carry flag unchanged.)
CMP AL, 'a'compares and sets the flags that jumps read: ZF for equal, CF for smaller (unsigned), SF and OF together for signed.
JMP label / JE, JNE, JB, JA...jump always, or only when the flags say so. JE means jump if equal.
LOOP labelsubtracts one from CX and jumps back while CX is not zero.
MOV AH, 09h / INT 21hasks DOS to print the $-terminated string whose address is in DX.
MOV AH, 4Ch / INT 21hends the program. Every program here finishes this way.

Practice: five exercises

Each exercise adds one idea. Try it in the editor first; every solution is checked against this exact simulator, so if yours prints the same thing, it counts. Reading a hint after two honest minutes is studying, not cheating.

  1. 1Print your own name

    The loaded example prints "Hello, World!". Change it so the program prints your name instead. One string, one print, one exit.

    Show a hint

    You only need to edit the DB line. The string must end with $ or the print will run on into whatever bytes come next.

    Show the solution
    ORG 0100h
    
        MOV DX, name    ; DX = address of the text
        MOV AH, 09h     ; print a $-terminated string
        INT 21h
    
        MOV AH, 4Ch     ; end the program
        INT 21h
    
    name DB "Riya$"    ; <- put your name here, keep the $
  2. 2Countdown from 9 to 1

    Print the digits 9, 8, 7 ... 1 on one line. This flips the counting example: instead of INC BL you DEC BL, and CX starts at 9.

    Show a hint

    Start BL one PAST the first character you want (':' comes after '9'), then DEC before each print.

    Show the solution
    ORG 0100h
    
        MOV CX, 9       ; nine digits to print
        MOV BL, ':'     ; one past '9'
    top:
        DEC BL          ; ':' -> '9' -> '8' -> ...
        MOV DL, BL
        MOV AH, 02h     ; print the character in DL
        INT 21h
        LOOP top        ; CX = CX-1, repeat while CX > 0
    
        MOV AH, 4Ch
        INT 21h
  3. 3Add two numbers stored in memory

    Store 4 and 5 with two DB lines, add them, and print the single-digit result. This is the first program that reads data from memory.

    Show a hint

    [A] means the value stored at A (the brackets matter: without them you would get A's address). A digit character is the value plus '0'.

    Show the solution
    ORG 0100h
    
        MOV AL, [A]     ; AL = the byte stored at A
        ADD AL, [B]     ; AL = 4 + 5 = 9
        ADD AL, '0'     ; 9 -> the character "9"
        MOV DL, AL
        MOV AH, 02h
        INT 21h
    
        MOV AH, 4Ch
        INT 21h
    
    A DB 4
    B DB 5
  4. 4Print two strings on separate lines

    Print FIRST, then a newline, then SECOND. There is no println in DOS, so a newline is two characters you print yourself: 0Dh (carriage return) and 0Ah (line feed).

    Show a hint

    Print the first string with AH=09h, then use AH=02h twice for 0Dh and 0Ah, then print the second string.

    Show the solution
    ORG 0100h
    
        MOV DX, first
        MOV AH, 09h     ; print FIRST
        INT 21h
    
        MOV DL, 0Dh     ; carriage return
        MOV AH, 02h
        INT 21h
        MOV DL, 0Ah     ; line feed
        INT 21h
    
        MOV DX, second
        MOV AH, 09h     ; print SECOND
        INT 21h
    
        MOV AH, 4Ch
        INT 21h
    
    first  DB "FIRST$"
    second DB "SECOND$"
  5. 5Count the characters in a string

    Walk the string SCRAMBLE one byte at a time until you hit $, count the steps in CX, then print the count. This combines pointers, compares, a loop and printing into one program.

    Show a hint

    Use SI as the pointer and CX as the counter. Compare [SI] with '$' and jump out when equal; otherwise INC both and loop. Print CL at the end (it fits, the word is short).

    Show the solution
    ORG 0100h
    
        MOV SI, word    ; SI points at the first character
        MOV CX, 0       ; the counter
    next:
        MOV AL, [SI]    ; read the character SI points at
        CMP AL, '$'     ; end of the string?
        JE done
        INC CX          ; one more character
        INC SI          ; move to the next one
        JMP next
    
    done:
        MOV DL, CL      ; print the count as a digit
        ADD DL, '0'
        MOV AH, 02h
        INT 21h
    
        MOV AH, 4Ch
        INT 21h
    
    word DB "SCRAMBLE$"

When the five exercises feel comfortable, you know more assembly than most people who claim to know it: registers, flags, jumps, loops, memory addressing and the DOS print services. From there, good next steps are the stack (PUSH, POP, CALL) and string handling with SI and DI, both practiced right in the editor above. Curious how another language runs without an install? The Python playground runs real CPython the same way.

How do I run assembly code online?

  1. 1

    Write or paste your program in the editor. The Hello, World example is already loaded, so you can just press Run to see the assembler and CPU work.

  2. 2

    Watch the register panel on the right. AX, BX, CX and DX update as your program runs, and the flag chips (ZF, SF, CF, OF) show what the last instruction changed.

  3. 3

    For printing, use INT 21h: put 09h in AH to print a $-terminated string, 02h in AH to print one character, and 4Ch in AH to end the program.

  4. 4

    Step executes exactly one instruction so you can connect each line to its effect. If something breaks, the error names the line and the reason in plain English.

What this online assembly compiler gives you

A CPU you can watch

Every register shows its hex and decimal value, and 16-bit registers break out their two halves (AH and AL, for example) because half-register tricks are everywhere in real 8086 code. The flag chips update on every instruction.

Single-step debugging

Step runs one instruction and highlights the next line in your source. Watching CX count down or CF flip after an ADD teaches more in five steps than a chapter of theory, and nothing is hidden from you.

Memory you can inspect

A live memory view shows the bytes around any address, including the ASCII text, so a DB string stops being magic. Change the address to see your data section and your program side by side.

Classic DOS printing

INT 21h works the way every tutorial teaches it: AH=09h prints a $-terminated string, AH=02h prints one character, AH=01h reads a character from the input box, and AH=4Ch ends the program.

Helpful errors, not hex dumps

Mistakes come back as plain sentences with line numbers, like a missing bracket or a jump into data. Click the line number and the editor takes you straight there.

Private and instant

The assembler and simulator are plain JavaScript in your tab. There is no account, no upload and no usage limit, your code auto-saves to your own browser, and the page keeps working offline once loaded.

Online assembly options compared

Where this simulator fits among the ways beginners usually meet assembly, judged for a first week of learning rather than for production work.

What mattersThis simulatorEMU8086Compiler ExplorerDOSBox + NASM
Install neededNoneWindows app, paid after trialNoneDOSBox, NASM, editor setup
Runs in a browser tabYesNoYesNo
Watch registers and flags liveYes, every stepYesShows compiler output, not a running CPUThrough DOS debug, painfully
Single-step from sourceYes, with line highlightYesNoPossible, clunky
Beginner error messagesPlain sentences with line numbersMixedCompiler diagnosticsAssembler errors only
Exact 8086 machine encodingNo (teaching simulator)YesReal compilersYes
CostFree, no accountPaid licenseFreeFree

Honest footnote: EMU8086 is the better pick when you need true machine-code encoding or DOS graphics, and Compiler Explorer is unbeatable for seeing what real C compilers emit. This page wins the first five minutes: open, type, run, watch what the CPU does. If you outgrow it, everything you learned here transfers.

What is assembly language, in plain words?

A processor never sees your loops or function names. It sees instructions like "put this number in a register", "add these two values", "jump back if the last compare said not equal". Assembly language is those instructions written as readable text, one line per processor action, and an assembler is the program that checks your lines and runs them.

Most teaching courses use the 8086, a 1978 Intel chip, because its instruction set is small enough to hold in your head: eight 16-bit registers, a handful of flags, and addressing simple enough to follow on paper. Every modern x86 chip still understands these instructions, so what you practice here is the same foundation professional assembly programmers start with.

Is this a real 8086?

It is a faithful teaching model, not a chip replica. The registers, the flags, the addressing modes and the instruction semantics (what each instruction changes and leaves alone, down to details like INC preserving the carry flag) match the 8086. What differs: memory is one flat 64 KB space instead of overlapping segments, each instruction takes a fixed slot instead of its true variable-length machine encoding, and INT 21h supports the classic print, input and exit services.

For learning how programs drive a processor, those differences do not get in the way. If you later move to NASM or MASM, you will already know the parts that matter: registers, flags, jumps, the stack, and how memory addressing works. The comparison table above says exactly where this simulator stops and real toolchains begin.

How should a complete beginner practice?

Run the Hello, World example, then Step through it slowly with your eyes on the registers. After that, work through the tutorial and exercises below this tool: they are ordered so each one adds a single idea, from printing text to loops, memory access and string handling.

A good rhythm is one exercise per sitting, typing the solution yourself instead of pasting it. Typing is where the syntax sticks, and the register panel makes mistakes obvious fast: a wrong register shows up as a wrong character in the output within seconds.

Questions this tool answers

Frequently asked questions

Is this assembly compiler really free?

Yes. Every feature on the page, including stepping, memory view and all examples, is free with no account and no usage cap. The simulator runs in your browser, so there is no server cost per user to pass on to you.

Does my assembly code get uploaded anywhere?

No. Assembling and execution happen in your tab with JavaScript, and there is no upload endpoint on the page to send anything to. Your code is kept in your own browser's storage between visits, and you can clear it any time.

Can I learn assembly language here as a complete beginner?

That is what it is built for. Start with the loaded example, step through it, then work down the page: the tutorial explains registers and the print services, and the five exercises each add one idea with the solution hidden until you want it.

What is INT 21h in assembly?

It is the DOS service interrupt, the classic way 8086 programs talk to the outside world. You put a service number in AH and call INT 21h: 09h prints a $-terminated string whose address is in DX, 02h prints the single character in DL, 01h reads one character into AL, and 4Ch ends the program.

Why 8086 and not modern x86-64?

The 8086 instruction set is the subset every x86 chip still understands, and it is small enough to learn properly: eight registers, simple addressing and no distraction of 64-bit modes or vector units. University courses, EMU8086 and most books use it for the same reason. Moving to x86-64 later is mostly learning more registers on top of what you already know.

Which assembly syntax does the simulator use?

Intel syntax, the same operand order as NASM and MASM (destination first, like MOV AX, 5), with NASM-style brackets: a label alone means its address, and [label] means the value stored there. DB, DW, EQU, ORG and labels with or without colons all work as usual.