.erl

What is a .erl file?

Erlang Source File · Code and data · Ericsson · 1986

An .erl file is Erlang source code, a language built at Ericsson for telephone switches that must never stop. Its runtime excels at massive concurrency and powers systems like RabbitMQ and WhatsApp's backend.

Category
Code and data
MIME type
Type
Plain text
Also seen as
.hrl
Is a .erl file safe to open? Caution. An .erl file is program source that runs on the BEAM. Review unfamiliar code before compiling and running it.

What is a .erl file used for?

Erlang programs are built from millions of tiny isolated processes that crash and restart independently, the 'let it crash' philosophy. That design gives phone switches, message brokers and chat backends their famous uptime.

An .erl file holds a module; .hrl files are shared header/include files. Elixir runs on the same BEAM virtual machine and interoperates with Erlang code directly.

What opens a .erl file?

The .erl 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 (Erlang LS)
  • any text editor

macOS

  • VS Code (Erlang LS)
  • any text editor

Linux

  • VS Code (Erlang LS)
  • Emacs (erlang-mode)
  • any text editor

Open a .erl file step by step

  1. Confirm the file really is a .erl. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with VS Code (Erlang LS) or any text editor.
  3. On Mac, use VS Code (Erlang LS) or any text editor.
  4. On Linux, try VS Code (Erlang LS) or Emacs (erlang-mode).
  5. Still stuck? Convert the .erl to beam (bytecode), which opens more widely.

Why can't I open my .erl file?

Almost always because no installed app understands Erlang. 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 .erl at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

How to convert a .erl file

You can convert a .erl file to beam (bytecode) using a conversion tool or the export menu of an app that opens it.

Erlang 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 .erl file?

An .erl file is Erlang source code, a language built at Ericsson for telephone switches that must never stop. Its runtime excels at massive concurrency and powers systems like RabbitMQ and WhatsApp's backend.

How do I run an .erl file?

Compile it in the Erlang shell with c(module). and call its functions, or use rebar3 to build a project. The erl shell comes with the Erlang/OTP install.

What is the difference between .erl and .hrl?

An .erl file is a module with code; an .hrl file is a header holding shared record definitions and macros that modules include.

What is the relationship between Erlang and Elixir?

Both run on the BEAM virtual machine. Elixir adds a friendlier syntax and modern tooling, and the two languages can call each other's code directly.

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.