---
title: "Unkernel compiles a real Linux kernel to WebAssembly and boots a browser shell in under a second"
url: https://badiyaa.com/unkernel-linux-kernel-webassembly-browser/
published: 2026-11-22T18:00:00+00:00
modified: 2026-11-22T15:36:24+00:00
section: Tech
publisher: Badiyaa
---

# Unkernel compiles a real Linux kernel to WebAssembly and boots a browser shell in under a second

Unkernel compiles the real Linux kernel to WebAssembly, so Alpine and Debian boot in a browser tab in under a second after a 10 MB download.

A full Linux kernel now boots inside a browser tab in well under a second, and it is not pretending. Unkernel, an open-source project from developer Pooya Parsa, compiles Linux 7.x itself into a single WebAssembly module, so the scheduler, memory manager, ext4 file system and TCP/IP stack run as real compiled code rather than through an emulated PC.

According to [the project's GitHub repository](https://github.com/pithings/unkernel), the kernel reaches its first program, /init, roughly 70 milliseconds after starting, and an Alpine Linux prompt shows up 0.3 seconds after launch under Node. A visitor to the demo page downloads about 10 MB before a shell appears. By the weekend the repository had close to 1,000 stars and 51 forks.

## What makes unkernel different

Running Linux in a web page is not new. Older projects generally pick one of three shortcuts, and the unkernel README lays them out plainly. Some emulate an entire PC, kernel and all, which is faithful but slow because every system call passes through fake hardware. Some emulate only the CPU and write their own stand-in for the Linux system calls, which is quick but covers only what the authors reimplemented. Others rebuild programs for WebAssembly and run them on a kernel with no memory management unit, which breaks fork and anything else that depends on real page tables.

Unkernel takes a hybrid route. The kernel is native WebAssembly, while ordinary programs are unmodified 64-bit Arm (aarch64) Linux binaries running on kwemu, a small CPU emulator written in Zig and linked straight into the kernel. Because kwemu reads the kernel's own page tables, Linux does its own memory management. When a program makes a system call, control returns to the kernel directly, with no emulated trap in the middle.

The practical result is that stock packages from Alpine and Debian install and run unchanged. The repository says the setup is complete enough for systemd to bring Ubuntu 26.10 up to multi-user mode, and that Node, npm, Python, curl and OpenSSL all work from the distribution archives.

## The numbers, side by side

The project's own benchmarks, measured under Node on November 14, show where the design pays off:

- **getppid system call:** about 172 nanoseconds in unkernel, against 110 natively and 1,662 under a full qemu-system emulator.

- **fork, exit and wait:** about 57 microseconds, slightly faster than the 73 microseconds measured natively, and roughly 20 times quicker than qemu-system's 1,178.

- **Pure computation:** still well behind native. Installing Python with apk takes about 3.4 seconds.

Put simply, the kernel path runs at close to native speed, while number-crunching inside user programs is the weak spot. A just-in-time compiler that turns hot Arm code into WebAssembly while it runs makes a shell loop 1.6 times faster and a sort job 2.3 times faster than the interpreter alone, per the README.

## Why WebAssembly can carry a kernel now

WebAssembly launched in March 2017 and became a W3C recommendation in December 2019, as [Wikipedia's WebAssembly article](https://en.wikipedia.org/wiki/WebAssembly) records. Its later versions added SIMD instructions and, in September 2025, a 64-bit address space. Unkernel also leans on JSPI, a browser feature that lets WebAssembly code pause and resume, so the kernel gets real stacks for switching between tasks. The README lists Chrome and Edge 137 or newer, Firefox 153 or newer, and Safari 27 or newer as working, including on phones.

Badiyaa recently covered a related trick in [Winedroid, which runs Android apps in a browser through WebAssembly](https://badiyaa.com/winedroid-android-apps-webassembly-browser/), and the kernel side of the story in [Linus Torvalds' notes on the Linux 7.4 merge window](https://badiyaa.com/linus-torvalds-linux-74-ai-fixes/).

## Known limits

The project is candid about the gaps. There is no IPv6, no inbound network connections and no UDP beyond DHCP and DNS. Debugging tools such as strace and gdb do not work yet, and a crash inside the kernel ends the session. Browsers cannot open raw TCP sockets, so internet access goes through a proxy.

The embedding kit is MIT-licensed and published on npm, while the kernel patches stay under the GPL. Developers can try it today with a single command, npx unkernel, which boots Alpine in a terminal and downloads a roughly 4 MB disk image on first run.

## Sources
- [unkernel: A real Linux kernel, compiled to WebAssembly](https://github.com/pithings/unkernel), pithings on GitHub, 2026
- [WebAssembly](https://en.wikipedia.org/wiki/WebAssembly), Wikipedia, 2026

*Image: Kowalski7cc, CC0 via Wikimedia Commons*

*This article was produced with AI assistance and reviewed by our Editorial Desk. [How we work](https://badiyaa.com/editorial-policy/).*
