.njk
🌐 WebText-based

.njk File — Nunjucks Template

text/x-nunjucks

File Inspector

Drop any file to identify its extension and type — runs entirely in your browser

NJK

Drop a .njk file here or click to choose

Or drop any file to identify its extension

Expected MIME type:text/x-nunjucks

Quick Facts

Extension.njk
Full NameNunjucks Template
MIME Typetext/x-nunjucks
CategoryWeb
TypeText-based (human-readable)
Typical Size1 KB – 20 KB
First Appeared2013

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

VS Code
Sublime Text
WebStorm
any text editor

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.