.ex File Extension
.ex file contains, how to open and compile Elixir source, how Poly supports it, and why some Euphoria programs use the same suffix. File extension details for .ex
Full Support| File type | Elixir or Euphoria source code |
|---|---|
| MIME type | |
| Encoding | Plain text, commonly UTF-8 |
| Operating systems | Windows, macOS, Linux |
| Opens with | Visual Studio Code, IntelliJ IDEA, Vim or Neovim, Any text editor |
| Poly support | Yes. Poly recognizes .ex as readable source code. |
| Indexed by Poly | Yes. Poly indexes readable source for exact and semantic search. |
| Preview in Poly | Yes. EX source opens in Poly's code editor with syntax highlighting. |
| Poly agent | Yes. The Poly agent can read and reason about the source text. |
What kind of file is a .ex?
A .ex file usually contains Elixir source code intended for compilation. Elixir is a dynamic, functional language that runs on the Erlang virtual machine. A source file commonly defines one or more modules with defmodule; compiling it produces BEAM bytecode rather than changing the source file itself.1
The suffix is ambiguous. OpenEuphoria also uses .ex by convention for a console main program or another executable source program.2 Both meanings are plain text and have no fixed magic bytes, so a filename alone cannot reliably distinguish them. Elixir forms such as defmodule and Euphoria forms such as procedure can provide useful clues.
IANA does not register a dedicated Elixir or Euphoria media type.3 Poly classifies .ex as readable text/plain. UTF-8 is the practical default for Elixir projects, whose language syntax and strings support Unicode.4
.ex does not translate its language. Renaming a compiled .beam file to .ex does not recover the original source.How do I open a .ex on my computer?
Any text editor can open .ex. Visual Studio Code, IntelliJ IDEA, Vim, and Neovim can add Elixir-aware highlighting, formatting, navigation, and language-server features. Install Elixir and Erlang/OTP when you need to compile or run Elixir code on Windows, macOS, or Linux.5
In an Elixir project, let Mix follow the project's dependencies and configuration:
mix compile
mix test
For a small standalone file, elixirc math.ex compiles its modules and writes .beam bytecode. Elixir uses .exs for scripts by convention; the language treats .ex and .exs the same, but .ex signals compilation while .exs signals scripting.1
If the file contains Euphoria, use an OpenEuphoria editor or run it with eui according to that project's instructions.6 Viewing source is safe. Compiling or running unfamiliar code can execute arbitrary operations with your account's permissions.
Poly support for .ex
Poly opens .ex as source text in a read-only, code-friendly viewer with syntax highlighting, word wrap, and in-file search. It indexes readable content for exact and semantic search, so you can find a module by name or code by its purpose.
The Poly agent can summarize modules, explain functions, and help trace likely behavior. Poly does not execute code, fetch dependencies, expand macros, or reconstruct runtime state. Because .ex is ambiguous, Euphoria source remains readable and searchable even when language-specific highlighting favors the more common Elixir interpretation.
History of .ex
José Valim began work on Elixir in early 2011, and Elixir 1.0 was released on September 18, 2014.7 The .ex suffix became the conventional compiled-source form, alongside .exs for scripts and project configuration.
The suffix predates that use in Euphoria. OpenEuphoria retains .ex for console or general executable source, alongside .exw for GUI or Windows-oriented programs and .exu for Unix-specific programs.2
Working with .ex and alternatives
Use the surrounding project to identify the language and role:
| File form | Typical role |
|---|---|
.ex | Compiled Elixir source, or an OpenEuphoria main program |
.exs | Elixir script, test, or executable project configuration |
.beam | Compiled Erlang VM bytecode |
.e | Euphoria include file |
.exw / .exu | Euphoria platform or interface conventions |
Keep .ex source and project metadata such as mix.exs in version control. Treat _build and generated .beam files as build output unless the project says otherwise. Use mix format for Elixir code; it supports .ex and .exs inputs and can check formatting without rewriting files.8
Footnotes
- Elixir. Modules and Functions: Compilation and Scripting Mode. ↩ ↩2
- OpenEuphoria. Platform Specific Issues: Source File Extensions. The OpenEuphoria project dates Euphoria's first release to 1993. ↩ ↩2
- Internet Assigned Numbers Authority. Media Types Registry. ↩
- Elixir. Unicode Syntax. ↩
- Elixir. Install Elixir. ↩
- OpenEuphoria. Creating Euphoria Programs. ↩
- Elixir. Elixir v1.0 Released. ↩
- Elixir. mix format. ↩