Skip to main content

Online Erlang Compiler

Write Erlang, press run and read the output in seconds. Nothing to install and nothing to configure.

How it works

Free, no install, works on laptop and phone.

What is an online Erlang compiler?

An online Erlang compiler is a free tool that lets you write Erlang code in your browser and run it to see the output, with nothing to install. On Techsnap you can add input, run a program in seconds and use it on a laptop or a phone.

Updated December 2026

How to run Erlang code online

  1. Step 1

    Write your Erlang code

    Open the editor and type or paste your Erlang program. Syntax colours and indentation help you spot mistakes as you go.

  2. Step 2

    Press Run

    Your code is sent to a secure server that compiles and runs it. Add any input the program needs in the Input box first.

  3. Step 3

    Read the output

    Results and error messages appear below the editor within a few seconds. Fix, edit and run again as often as you like.

Everything you need to code in Erlang

Nothing to install

No Erlang setup, PATH or version problems. It works on a college lab PC or a phone.

Input support

Give your program input the same way a judge or exam platform does, then check the output.

Instant results

Most runs finish in a second or two, so you can try an idea and see what happens right away.

Free to start

Run code without paying. A free Techsnap account gives you more runs and saves your work.

Erlang code examples

Open the editor, paste one of these examples in and run it. Change a value and run it again to see what happens.

Hello World in Erlang

-module(main).
-export([main/0]).

main() ->
    io:format("Hello, Techsnap!~n").

Variables and data types

-module(main).
-export([main/0]).

main() ->
    Name = "Asha",
    Age = 21,
    Marks = 87.5,
    Passed = true,
    io:format("~s ~p ~p ~p~n", [Name, Age, Marks, Passed]).

If and case

-module(main).
-export([main/0]).

main() ->
    Marks = 72,
    Grade = if
        Marks >= 90 -> "A";
        Marks >= 60 -> "B";
        true -> "C"
    end,
    io:format("Grade ~s~n", [Grade]).

Loops with recursion and lists

-module(main).
-export([main/0]).

countdown(0) -> ok;
countdown(N) ->
    io:format("count: ~p~n", [N]),
    countdown(N - 1).

main() ->
    lists:foreach(fun(I) -> io:format("for: ~p~n", [I]) end, lists:seq(1, 3)),
    countdown(3).

Functions and pattern matching

-module(main).
-export([main/0]).

square(X) -> X * X.

describe(0) -> "zero";
describe(N) when N < 0 -> "negative";
describe(_) -> "positive".

main() ->
    io:format("~p~n", [square(7)]),
    io:format("~s ~s ~s~n", [describe(0), describe(-3), describe(8)]).

Lists, tuples and maps

-module(main).
-export([main/0]).

main() ->
    Nums = [4, 9, 12, 15, 20],
    io:format("~p~n", [[N * 2 || N <- Nums]]),
    io:format("~p~n", [lists:sum(Nums)]),
    Point = {3, 4},
    io:format("~p~n", [Point]),
    Marks = #{"DSA" => 90, "DBMS" => 82},
    io:format("DSA: ~p~n", [maps:get("DSA", Marks)]).

Records

-module(main).
-export([main/0]).

-record(student, {name, marks}).

main() ->
    S = #student{name = "Ravi", marks = 78},
    io:format("~s scored ~p~n", [S#student.name, S#student.marks]).

Error handling with try and catch

-module(main).
-export([main/0]).

main() ->
    try list_to_integer("twenty") of
        Age -> io:format("~p~n", [Age])
    catch
        error:badarg -> io:format("Caught: not a number~n")
    after
        io:format("Done~n")
    end.

Processes and messages

-module(main).
-export([main/0]).

main() ->
    Parent = self(),
    spawn(fun() -> Parent ! {result, 6 * 7} end),
    receive
        {result, Value} -> io:format("got ~p~n", [Value])
    after 1000 ->
        io:format("timeout~n")
    end.

File reading and writing

-module(main).
-export([main/0]).

main() ->
    file:write_file("notes.txt", "line one\nline two\n"),
    {ok, Data} = file:read_file("notes.txt"),
    Lines = string:split(string:trim(binary_to_list(Data)), "\n", all),
    lists:foreach(fun(L) -> io:format("read: ~s~n", [L]) end, Lines),
    file:delete("notes.txt").

How to take input in Erlang online

Erlang reads a line from standard input with io:get_line(""), which returns the text including the newline. Trim it and convert with list_to_integer.

main() ->
    N = list_to_integer(string:trim(io:get_line(""))),
    Nums = [list_to_integer(T) || T <- string:tokens(string:trim(io:get_line("")), " ")],
    io:format("count: ~p~n", [N]),
    io:format("sum: ~p~n", [lists:sum(Nums)]).

Common Erlang errors and how to fix them

variable 'x' is unbound
Variable names in Erlang start with a capital letter. A lowercase name is an atom, and a variable must be given a value before you use it.
syntax error before: '.'
Statements are separated with commas, clauses with semicolons, and the whole function ends with a full stop. Check which one is wrong.
no function clause matching
The arguments do not match any function head. Add a clause for that case or a catch-all with an underscore.

Who uses an online Erlang compiler

Students and learners

Practise Erlang for class assignments and exams without installing anything.

Teachers and mentors

Share a short program in a lesson and let students run and change it on their own devices.

Interview candidates

Rehearse Erlang questions in the same plain editor many online tests use.

Working developers

Check a snippet or an API behaviour in seconds without opening an IDE.

Writers and bloggers

Test code samples so the examples in your tutorials really run.

Teams

Paste a reproducible example into a ticket or chat so everyone sees the same result.

Online compiler vs local Erlang setup

Techsnap online compilerLocal setup
Setup timeNone, open the pageInstall Erlang, set PATH, pick a version
Works on any deviceYes, any modern browserOnly the machine you set up
Best forPractice, quick tests, learningLarge projects and long-running work
Extra librariesStandard library onlyAnything you can install

About Erlang

What is Erlang?

Erlang is a functional language designed at Ericsson for telephone switches that must never stop. It runs many tiny lightweight processes that talk by sending messages and can be restarted if they fail.

What is Erlang used for?

Messaging systems, telecom, real-time services and distributed back-ends. WhatsApp and RabbitMQ are built on Erlang, and Elixir runs on the same virtual machine.

Erlang for beginners

Variables start with a capital letter and can be assigned once. Learn pattern matching, recursion and lists first. There are no loops, you use recursion and functions like lists:foreach.

Erlang vs other languages

Erlang is unusual: immutable data, no loops and processes instead of threads. This makes concurrent programs simpler and safer than in Java or C++, but needs a different way of thinking.

Why use an online Erlang compiler?

Setting up the Erlang runtime and a build tool is a lot for a first try. An online runner lets you test pattern matching and processes straight away.

Erlang career opportunities

Telecom, fintech and messaging companies hire Erlang and Elixir engineers. Experience with concurrency and fault tolerance is valued in distributed systems roles.

Explore more online compilers

Frequently asked questions

Is this online Erlang compiler free?

Yes. Write and run Erlang code in your browser for free, with nothing to install. A free Techsnap account gives you more runs and saves your work.

Why does my code need a module line?

Every Erlang source file is a module. The first lines declare the module name and list the exported functions, here main/0.

How do I take input in Erlang online?

Use the Input box and read lines with io:get_line(""), as shown on this page.

Can I run Erlang on my phone?

Yes. The editor, input and output work in a mobile browser, so you can practise without a laptop.

Ready to write Erlang code?

Open the editor and run your first program in under a minute.