Online Erlang Compiler
Compile and run Erlang online with Erlang/OTP 28. Write a module called main with a start/0 function, press Run, and it is compiled with erlc and started with erl, with compiler errors shown by line and column. Programs can read input with io:get_line as they run.
How to run Erlang code online
- This page opens with Erlang selected, so you can start typing straight away.
- Write your code in the editor, or open files from your computer: single files, or a whole project as a .zip.
- Press Run, or Ctrl+Enter. The output appears in the panel beside the editor, and when the program asks for input you type it there and press Enter.
- Share a copy with a link, or save your files to your computer.
Erlang/OTP 28 on Online IDE
- Your file is compiled with erlc, then run with erl -noshell -s main start -s init stop, so the program begins in start/0.
- Keep -module(main). and -export([start/0]). at the top: the module name must match the file name, main.erl.
- io:get_line("Prompt: ") shows the prompt and returns the line you type in the output panel, newline included.
- Compiler errors and warnings show the line and column, and halt(N) ends the program with exit code N.
Example: an Erlang program that reads input
-module(main).
-export([start/0]).
start() ->
Line = io:get_line("Enter a whole number: "),
case string:to_integer(string:trim(Line)) of
{N, []} when N >= 0 ->
io:format("~b! = ~b~n", [N, factorial(N)]);
_ ->
io:format("Please enter a whole number of 0 or more.~n")
end.
factorial(0) -> 1;
factorial(N) -> N * factorial(N - 1).
Features of this tool
- Simple and fastA clean, lightweight editor that opens instantly.
- Powered by AceThe Ace code editor, with syntax highlighting, autocompletion and bracket matching.
- Interactive programsType input into the terminal while your program runs.
- Several filesWork in tabs, open files or a .zip from your computer, and save the project back to disk.
- Made for learningHelpful for beginners to learn and practice programs.
- Light and dark themesPlus 39 editor themes, a choice of coding fonts, and Vim, Emacs or VS Code keys.
- Keep your outputCopy or download the program output in one click.
- Share by linkSave your code in the cloud and open it anywhere.
Frequently asked questions
Which Erlang version does Online IDE use?
Erlang/OTP 28, compiled with erlc and run with erl on Linux.
Why must the module be called main?
Erlang requires a module to live in a file of the same name, and the file is main.erl. The runner then calls main:start(), so export start/0 and begin your program there.
How does an Erlang program read input?
Call io:get_line("Prompt: "), which waits for a line you type in the output panel. Use string:trim/1 to drop the newline.
How do I set the exit code?
Call halt(N) to stop with exit code N. When start/0 returns, the program ends with exit code 0.
Contact us
For any feedback, queries or issues, please feel free to contact us or write to . We value your input and are committed to providing the best possible experience for our users.