Online compiler
Assembly online compiler
Write Assembly (NASM 3) code below and run it, with input, in a sandbox on our servers. No sign-in, no ads. The same compiler is an API and an embeddable editor, for running Assembly in your own app, course or docs.
By the OnlineCompiler.io team. Updated .
What runs your code
| Version | Assembly NASM 3 |
|---|---|
| Compiled with | nasm -f elf64 code.asm -o code.o && ld code.o -o code.out |
| Run with | ./code.out |
| Limits | 30 seconds, 512 MB of memory, 2 CPUs, 64 KB of output per stream, no network |
| Typical run | 0.68 s, and 0.84 s for the slowest 1 in 20 (how we measured) |
Good to know
- Assembles 64-bit x86-64 Linux code with NASM 3 (
nasm -f elf64). - A program with a global
mainis linked with the C library, so it can callprintfandscanf. One with_startis linked on its own and uses system calls. - Use
syscallwith the 64-bit call numbers (1 is write, 60 is exit). 32-bitint 0x80calls crash with exit code 139.
Run Assembly from your own code
Send the code and its input to the sync endpoint with an API key, and the output comes back in the response. The API docs cover the async endpoint with callbacks and every response field.
curl -X POST https://api.onlinecompiler.io/api/run-code-sync/ \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"compiler": "nasm-3",
"code": "extern scanf\nextern printf\n\nsection .data\nfmt_in db \"%63s\", 0\nfmt_out db \"Hello, %s!\", 10, 0\n\nsection .bss\nname resb 64\n\nsection .text\nglobal main\nmain:\n sub rsp, 8\n lea rdi, [rel fmt_in]\n lea rsi, [rel name]\n xor eax, eax\n call scanf\n lea rdi, [rel fmt_out]\n lea rsi, [rel name]\n xor eax, eax\n call printf\n add rsp, 8\n xor eax, eax\n ret",
"input": "Ada"
}'The response has output ("Hello, Ada!\n" here), error, exit_code, time and memory.
Put a runnable Assembly example on your site
The editor above is the embeddable widget. Add the script and a div with your widget key, and your readers can edit and run the code without an account:
<script src="https://onlinecompiler.io/widget.js"></script>
<div class="runcode" data-key="YOUR_WIDGET_KEY" data-lang="nasm-3">
<script type="text/plain">
extern scanf
extern printf
section .data
fmt_in db "%63s", 0
fmt_out db "Hello, %s!", 10, 0
section .bss
name resb 64
section .text
global main
main:
sub rsp, 8
lea rdi, [rel fmt_in]
lea rsi, [rel name]
xor eax, eax
call scanf
lea rdi, [rel fmt_out]
lea rsi, [rel name]
xor eax, eax
call printf
add rsp, 8
xor eax, eax
ret
</script>
</div>On a platform that takes an iframe but not a script, such as many course sites, use the iframe embed. For Docusaurus, MkDocs, Sphinx and Mintlify, see runnable code examples in docs.
Other languages
Python, C, C++, Java, C#, F#, Go, Rust, PHP, Ruby, Haskell, TypeScript, JavaScript, SQL, Bash, Fortran, Visual Basic, Kotlin, R, Swift, COBOL, Perl, Julia, Pascal, Octave, Lua, OCaml, Common Lisp, Erlang, Elixir, Prolog, D, FreeBASIC, Dart, Clojure, Groovy, Scala, Zig, Nim, Crystal, Ada, PowerShell, Racket, Objective-C.
Frequently asked questions
Is this Assembly online compiler free?
Yes. Running Assembly on this page needs no account and shows no ads. To run Assembly from your own app or site, the API and the widget are free up to 100,000 runs a month, commercial use included.
Can my Assembly program read input?
Yes. Type it in the Input tab before you run, and the program reads it from standard input. The whole input is sent when you press Run, so a program can't ask for more while it runs.
Can I use Assembly libraries?
The C standard library, for programs that define <code>main</code>. There are no other libraries or include files, and programs have no network access.
How long can a program run?
Up to 30 seconds, with 512 MB of memory and 2 CPUs. A program still running at 30 seconds is stopped with exit code 124, and output over 64 KB per stream is cut.
Where does my code run?
On our servers, in a fresh gVisor sandbox with no network access that is deleted when the run ends. Each run is kept in execution history with its output; the security page says what is stored.