What is a .ex file?
Elixir Source File · Code and data · José Valim · 2011
An .ex file is Elixir source code, a functional language that runs on the Erlang virtual machine (BEAM). It is built for scalable, fault-tolerant systems, and powers the Phoenix web framework.
What is a .ex file used for?
Elixir brings a friendly, Ruby-inspired syntax to the battle-tested Erlang runtime, which excels at concurrency and staying up under load. Compiled .ex files build a project; .exs files are scripts run directly.
It is popular for real-time web apps and distributed systems. The files are plain text; VS Code with ElixirLS is the usual editor.
How to open a .ex file
The .ex 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 .ex file.
Windows
- VS Code (ElixirLS)
- any text editor
macOS
- VS Code (ElixirLS)
- any text editor
Linux
- VS Code (ElixirLS)
- any text editor
.ex file signature (magic bytes)
Programs recognise a .ex file by the bytes at the start of the file, not by its name. These are the signatures for Elixir.
| 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 .ex file?
An .ex file is Elixir source code, a functional language that runs on the Erlang virtual machine (BEAM). It is built for scalable, fault-tolerant systems, and powers the Phoenix web framework.
What is the difference between .ex and .exs?
A .ex file is compiled as part of a project; a .exs file is a script Elixir runs directly, without a build step. Both are Elixir source.
How do I run an Elixir file?
Run a script with elixir file.exs, or build and run a project with mix, Elixir's build tool.
Why is Elixir good for scalable apps?
It runs on the Erlang BEAM, which was designed for massive concurrency and fault tolerance, so Elixir handles many simultaneous connections reliably.
Related formats
Sources
Details on this page were checked against authoritative references: