About
About numlit
A free, open tool for one specific, easily-missed question: what does each language’s compiler think your literal is?
Every language has its own lexer rules for how a numeric literal is written — prefixes, leading zeros, digit separators,
suffixes — and they disagree. 017 is octal in C but decimal in Rust and an error in Python; 1_000
works almost everywhere except C (which uses an apostrophe); 100L is a long in Java but a syntax error in Go. Copy
a constant from one codebase to another and its value can silently change.
numlit takes one numeric literal — written exactly as in source — and reports how C, Rust, Go, Java, Python and JavaScript each lex it: validity, default type, exact value, and the overflow/precision/leading-zero traps that make the same text mean different things. Integer values are exact via BigInt; floats use IEEE-754 binary64; the rules follow each language’s specification. It is not a base converter — it answers what a compiler thinks your literal is. It runs entirely in your browser.
It covers C (C23), Rust, Go, Java, Python 3 and JavaScript, and the common literal forms. This is deliberately not a base converter — those are everywhere; numlit instead surfaces the cross-language parsing differences and the overflow / precision / leading-zero traps. Because it is a static page, the literal you type stays in your browser.
The rules follow each language’s specification, but lexer corners are subtle — for anything unusual, confirm against the official reference and your actual compiler. Open the parser →