Zig
A pre-1.0 systems language and toolchain with no hidden control flow or allocations, compile-time code in plain Zig, and a built-in C compiler that cross-compiles anywhere.
- What it is
- Programming languages (compiled to machine code)
- Type
- Open source
- Made by
- Zig Software Foundation
- License
- MIT
- Facts checked
- 8 October 2026
What it is
Zig compiles to machine code and aims to be a better C: what you read is what runs. There is no operator overloading, no exceptions and no property getters, so a = b + c.d; foo(); bar(); calls exactly foo and then bar. There are no hidden allocations either: the language has no new and never touches the heap on its own, and every standard library function that needs memory takes an Allocator argument, so the same code can run on a server, in WebAssembly or on bare metal. A debug allocator catches use-after-free, double free and leaks in testing, and an arena allocator frees a whole batch at once. Of the four build modes, Debug and ReleaseSafe crash on integer overflow or out-of-bounds access instead of running into undefined behaviour; ReleaseFast and ReleaseSmall drop those checks for speed and size.
Instead of macros or a separate generics system, Zig runs ordinary Zig code at compile time. A parameter marked comptime must be known when compiling, types are values, and a generic container is just a function that returns a type. The toolchain is also a C and C++ compiler: zig cc takes the same options as Clang and GCC, ships libc source code that it builds on demand, and cross-compiles to Windows, macOS or Linux from any of them out of the box. Zig is still before 1.0. Version 0.17.0 (1 October 2026) is the latest release, and each release changes the language and standard library, so code needs updating between versions.
Why teams pick it
- Explicit by design: no hidden function calls or heap allocations, so code is easy to audit and reuse in constrained environments
comptimegives generics and reflection with ordinary Zig code, no macro languagezig ccis a drop-in C/C++ compiler and cross-compiler that bundles libc, useful even in projects with no Zig code- Small, static binaries: a stripped ReleaseSmall hello world is a 9.8 KiB static executable on x86_64 Linux
Watch out for
- Pre-1.0: every release (0.17.0 in October 2026) changes the language or standard library, with upgrade guides rather than a compatibility promise
- Manual memory management: the debug allocator and runtime safety checks catch many memory bugs, but ReleaseFast and ReleaseSmall builds run without the checks
- A small core team paid from donations to a non-profit, which asks for more donations to speed up the road to 1.0
- Optimized release builds still go through LLVM (LLVM 22 in 0.17.0), and some of Zig’s own backends, such as WebAssembly and aarch64, aren’t the default yet
Alternatives
What all compiled to machine code have in common →How it fits with other technologies
What Zig uses
Code run at compile time, and memory from an explicit allocator · zig
const std = @import("std");
fn fibonacci(n: u32) u32 {
if (n <= 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
}
pub fn main() !void {
// the compiler runs fibonacci; the binary just holds the number 55
const fib10 = comptime fibonacci(10);
// nothing allocates unless you pass an allocator in
const allocator = std.heap.page_allocator;
const squares = try allocator.alloc(u32, 5);
defer allocator.free(squares); // runs when main returns
for (squares, 0..) |*s, i| s.* = @intCast(i * i);
std.debug.print("{d} {d}\n", .{ fib10, squares[4] }); // 55 16
}See it in a real stack
No architecture uses Zig yet. Drop it into the playground and wire it up yourself.Open playground →Where it came from2016–2026
Andrew Kelley started Zig in 2015 while working on Genesis, a digital audio workstation, and introduced it in a February 2016 post. His goal was a language “more pragmatic than C”, with priorities in a fixed order: pragmatic, optimal (as fast as C or faster), safe, and readable. From the start Zig separated debug builds, which compile fast and trap on undefined behaviour, from release builds that optimize without compromise.
In March 2020 Kelley showed that zig cc could act as a drop-in replacement for GCC and Clang, cross-compiling C code with a 45 MiB download where Clang’s own tarballs ran to 380 MiB. In July 2020 he founded the Zig Software Foundation, a 501(c)(3) non-profit funded by donations, to pay core developers instead of taking venture capital.
In November 2025 the project moved its source code from GitHub to Codeberg. Zig is still working towards 1.0; 0.17.0 shipped on 1 October 2026 with 925 commits from 206 contributors.
Why it’s built this way
- No hidden control flow
- Operator overloading, exceptions and property functions in C++, D, Rust and Go mean a line can call code you can’t see. Zig drops them so readers know exactly which functions run.
- No hidden allocations; allocators are parameters
- Code that allocates behind your back can’t be used in real-time, embedded or out-of-memory-sensitive settings. Passing an
Allocatorexplicitly makes every library usable everywhere, including freestanding targets. - Compile-time execution instead of macros
- Rather than a separate macro or template language, Zig evaluates normal Zig code at compile time, so generics, reflection and formatted printing are library code, not compiler special cases.
- Ship a C toolchain
- C is the most portable language, and a language that can’t work with C risks obscurity. Shipping a C compiler and libc sources lets Zig import C headers directly and build C projects for any target.
Timeline
- 2016
Andrew Kelley introduces Zig in February
- 2020
zig ccdrop-in C compiler announced in March - 2020
Zig Software Foundation founded in July
- 2025
Source code moves from GitHub to Codeberg in November
- 2026
Zig 0.17.0 released on 1 October
- Andrew Kelley: Introduction to the Zig Programming Language (8 February 2016)
- Andrew Kelley: `zig cc`, a powerful drop-in replacement for GCC/Clang (24 March 2020)
- Zig news: Announcing the Zig Software Foundation (11 July 2020)
- Zig news: Migrating from GitHub to Codeberg (26 November 2025)
- Zig 0.17.0 release notes
- Zig docs: Why Zig when there is already C++, D, and Rust?
Sources7 · facts checked 8 October 2026
- Zig docs: In-depth overview (debug and release safety, comptime, generics, C compiler, cross-compiling, 9.8 KiB hello world)
- Zig docs: Why Zig when there is already C++, D, and Rust? (no hidden control flow or allocations, allocators, tooling)
- Andrew Kelley: `zig cc`, a powerful drop-in replacement for GCC/Clang
- Zig 0.17.0 release notes (language changes, upgrade guides, LLVM 22, self-hosted backends)
- Zig downloads (0.17.0 on 2026-10-01)
- Zig news: Announcing the Zig Software Foundation
- Codeberg: ziglang/zig LICENSE (MIT)