.njk File — Nunjucks Template
text/x-nunjucks
Drop any file to identify its extension and type — runs entirely in your browser
Drop a .njk file here or click to choose
Or drop any file to identify its extension
text/x-nunjucksQuick Facts
| Extension | .njk |
| Full Name | Nunjucks Template |
| MIME Type | text/x-nunjucks |
| Category | Web |
| Type | Text-based (human-readable) |
| Typical Size | 1 KB – 20 KB |
| First Appeared | 2013 |
What Is a .njk File?
Nunjucks is a rich and powerful JavaScript template engine inspired by Jinja2 (Python), developed by Mozilla. NJK files use a syntax nearly identical to Jinja2/Twig with {{ }} for expressions, {% %} for statements, and {# #} for comments. Nunjucks provides template inheritance, includes, macros, filters, custom tags, asynchronous control, and auto-escaping. The engine is particularly popular in the JavaScript ecosystem for static site generation — Eleventy (11ty), one of the fastest-growing static site generators, supports Nunjucks as a first-class template language. Nunjucks runs both in Node.js (for server-side rendering and static site generation) and in the browser (for client-side templating). The template inheritance system allows defining base layouts with blocks that child templates override, enabling DRY template hierarchies. Nunjucks supports asynchronous operations in templates, useful for data fetching during rendering. Custom filters and extensions can add project-specific functionality. The engine precompiles templates for production performance and provides helpful error messages during development. Nunjucks' Jinja2-compatible syntax makes it familiar to developers from the Python ecosystem.
How to Open .njk Files
Related File Extensions
More Web File Extensions
Other web formats you might encounter
Browse File Extensions by Category
Explore our reference of 259 file extensions with details, programs, and related formats.