What is a .clj file?
Clojure Source File · Code and data · Rich Hickey · 2007
A .clj file is Clojure source code, a modern Lisp dialect that runs on the Java Virtual Machine. It emphasises functional programming and immutable data, and is valued for concise, robust backends and data processing.
What is a .clj file used for?
Clojure is a Lisp, so code is written as parenthesised expressions and data and code share the same structure. It runs on the JVM (and ClojureScript targets JavaScript), giving access to the Java ecosystem.
The files are plain text; editors with structural editing (Calva for VS Code, Cursive for IntelliJ) make the parentheses easy to manage.
What opens a .clj file?
The .clj format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list.
Windows
- VS Code (Calva)
- IntelliJ IDEA (Cursive)
- any text editor
macOS
- VS Code (Calva)
- IntelliJ IDEA (Cursive)
- any text editor
Linux
- VS Code (Calva)
- Emacs (CIDER)
- any text editor
Open a .clj file step by step
- Confirm the file really is a .clj. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
- On Windows, open it with VS Code (Calva) or IntelliJ IDEA (Cursive).
- On Mac, use VS Code (Calva) or IntelliJ IDEA (Cursive).
- On Linux, try VS Code (Calva) or Emacs (CIDER).
- Still stuck? Search for a dedicated Clojure viewer rather than a generic one.
Why can't I open my .clj file?
Almost always because no installed app understands Clojure. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.
The other possibility is that the file is not really a .clj at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.
Clojure has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.
Frequently asked questions
What is a .clj file?
A .clj file is Clojure source code, a modern Lisp dialect that runs on the Java Virtual Machine. It emphasises functional programming and immutable data, and is valued for concise, robust backends and data processing.
How do I run a .clj file?
Use the Clojure CLI (clojure -M file.clj) or a REPL, or run it inside a project with Leiningen or deps.edn tooling.
Is Clojure a Lisp?
Yes. Clojure is a modern Lisp dialect on the JVM, using S-expressions and treating code as data, with a strong focus on immutability.
What is the difference between .clj and .cljs?
A .clj file targets the JVM; a .cljs file is ClojureScript, which compiles to JavaScript for the browser. The language is largely shared.
Related formats
Sources
Details on this page were checked against authoritative references. How sources are ranked and what is deliberately left out is set out in the methodology.