Language Detector

Paste a code snippet and instantly get its most likely language — the detector scores keyword usage, distinctive syntax markers, comment style and your optional filename against signatures for 27 common languages (Python, JavaScript, Java, C/C++, C#, Go, Rust, SQL, HTML/CSS and more). The top three guesses are shown with the exact clues that matched. Heuristic, local and privacy-friendly: nothing leaves your browser.
How it works & limitations. Detection is heuristic: it counts distinctive keywords, syntax markers (e.g. , def , package main), comment styles and the file extension, then ranks the 27 signatures. Short or generic snippets can be ambiguous (e.g. import is shared by Python and Go), and the top guess can be wrong for mixed or heavily truncated code — treat the result as a suggestion. Supported: JavaScript, TypeScript, Python, Java, C, C++, C#, Go, Rust, Ruby, PHP, Swift, Kotlin, Objective-C, Bash, Perl, PowerShell, SQL, HTML, CSS, JSON, YAML, XML, Markdown, Scala, R, Lua.
How does code language detection work?

Detection is a classification problem with two broad approaches: statistical models trained on corpora (token frequencies, n-grams) and hand-built signature matching — what this page does. Each language has a signature of distinctive clues: keywords that only it uses (def, fn, public static void), syntax markers such as comment styles or <?php, and filename extensions. The detector counts which clues appear in the snippet and ranks the signatures that match best, showing you the exact evidence so you can judge it yourself.

Short snippets are inherently ambiguous — import alone exists in Python, Go and Java — so a detector’s ranking (and the clue list) is more informative than its single top guess.