Independent .NET for WebAssembly and WASI.
Write C#. Deploy small, standalone Wasm.
NetWasm is an independent compiler, CoreLib, runtime and SDK that compiles C#
and .NET CIL directly to WebAssembly. It does not carry the desktop CLR, Mono,
dotnet.js or application DLLs into production.
Compile C# to WebAssembly · Try it in the browser · Install and build · See supported APIs · Read the documentation
NetWasm + precise GC: 47,895 bytes
Rust 1.95.0 size-oriented profile: 53,635 bytes
For the same print-42 workload, NetWasm's result includes the runtime and
precise Compact garbage collector. Both artifacts are standalone WASI Preview 2
Components, built the way a developer gets them out of the box: each
toolchain's standard library and ordinary build, with no hand-added tools.
10.7% smaller raw. 19.5% smaller with Brotli-11.
| Toolchain | Raw Wasm | Brotli 11 | Comparison role |
|---|---|---|---|
| NetWasm, Compact GC | 47,895 B | 13,660 B | WASI P2 Component; precise GC included |
| Rust 1.95.0, size profile | 53,635 B | 16,963 B | Matched WASI P2 Component reference |
Kotlin 2.4.0 wasmWasi |
79,293 B | 22,655 B | P1 context; GC supplied by the host engine |
| TinyGo 0.39.0 | 93,043 B | 26,931 B | P1 context; precise GC configured |
Rust is the headline comparison because it uses the same workload and output form. Kotlin/Wasm and TinyGo show the broader footprint landscape, but their targets and runtime boundaries differ. This is a measured workload/profile result, not a language-wide size ranking.
NetWasm's figure is the template application's default Release publish. Rust's
adds Cargo's documented size settings (opt-level = "z", LTO, one codegen
unit, panic = "abort" and stripped symbols) to an ordinary cargo build.
Binaryen's wasm-opt is not a post-processing step here: it is part of NetWasm's
compiler pipeline and runs in every ordinary build, with nothing to install or
enable. Rust's wasm32-wasip2 output is a component, so applying wasm-opt to it
means extracting the core module, optimizing it and re-encoding the component
by hand.