What is a .nim file?
Nim Source File · Code and data · Andreas Rumpf and the Nim team · 2008
A .nim file is Nim source code, a compiled language with Python-like indentation syntax and C-like speed. It compiles through C, giving small, fast binaries with easy interop.
What is a .nim file used for?
Nim's pitch is 'looks like Python, runs like C': whitespace-based syntax and type inference on top of a compiler that emits C (or JavaScript), so programs are small, fast and portable.
It has a powerful macro system and optional garbage collection, which attracts systems programmers and game developers who want expressiveness without a heavy runtime.
How to open a .nim file
The .nim format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .nim file.
Windows
- VS Code (Nim extension)
- any text editor
macOS
- VS Code (Nim extension)
- any text editor
Linux
- VS Code (Nim extension)
- any text editor
How to convert a .nim file
You can convert a .nim file to exe (compiled), js (compiled) using a conversion tool or the export menu of an app that opens it.
.nim file signature (magic bytes)
Programs recognise a .nim file by the bytes at the start of the file, not by its name. These are the signatures for Nim.
| Hex signature | Offset | Note |
|---|---|---|
| (no fixed signature) | 0 | plain text; no fixed magic bytes |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .nim file?
A .nim file is Nim source code, a compiled language with Python-like indentation syntax and C-like speed. It compiles through C, giving small, fast binaries with easy interop.
How do I run a .nim file?
Install Nim and run nim c -r file.nim, which compiles the file and runs the resulting binary in one step.
Is Nim as fast as C?
Close. Nim compiles to C and leans on the C compiler's optimizer, so well-written Nim generally lands in the same performance class as C and C++.
Why does Nim look like Python?
It deliberately borrows Python's indentation-based, low-punctuation syntax to stay readable, while remaining a statically typed, compiled language.
Related formats
Sources
Details on this page were checked against authoritative references: