XCODX |

Elixir Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About Elixir

Elixir is a dynamically typed, functional language that runs on the Erlang virtual machine, the BEAM. It was created by Jose Valim, who started the project in 2011 to pair a friendlier syntax and modern tooling with Erlang's concurrency and fault-tolerance model. Programs are built from lightweight processes that share no memory and communicate by passing messages, which makes fault-tolerant, highly concurrent systems the language's natural domain. Elixir is best known for the Phoenix web framework and runs in production at companies such as Discord, Pinterest, and Bleacher Report. On XCODX, Elixir runs in a cloud sandbox as a script, so you can try the language and its standard library without installing Erlang or the Mix build tool.

Hello World in Elixir

# Elixir script on the BEAM: read a line, then work with a range
name = IO.gets("What is your name? ") |> String.trim()
IO.puts("Hello, #{name}!")

sum = Enum.sum(1..10)
IO.puts("Sum of 1..10 is #{sum}")

When to use Elixir

Elixir is a strong choice when you need to handle many simultaneous connections with predictable latency and stay up under partial failure, such as chat systems, messaging backends, IoT fleets, and live dashboards. The BEAM's supervision trees let parts of a system crash and restart without taking the whole thing down. The Phoenix framework and its LiveView feature build interactive web apps without much client-side JavaScript. It is a weaker fit for CPU-bound number crunching, where the BEAM is slower than native-code or JVM options.

Common questions

How do I read input in Elixir?

IO.gets/1 reads one line from standard input including the trailing newline, so pair it with String.trim/1; IO.read(:stdio, :all) reads the whole stream at once. On XCODX you can type into the live terminal, which pauses until you press Enter, or paste into the Stdin Box up front, and Ctrl+D closes the stream so :all returns.

Can I add dependencies with Mix and Hex?

No. The sandbox runs a single script with the elixir command and has no network access, so there is no mix project, no mix.exs, and no Hex download. You get the standard library, such as Kernel, Enum, String, and IO, but packages like Phoenix or Ecto are unavailable.

Do I need to define a module with defmodule?

Not for short programs. A script evaluates top-level expressions directly, so you can call IO.puts and Enum functions without a module. Reach for defmodule when you want named functions, structs, or behaviours.

Can I spawn processes and use GenServer here?

Yes, for in-memory concurrency. spawn, send and receive, Task, and Agent all work within a single run because the BEAM is running underneath. What you cannot do is talk to other nodes or the network, and nothing persists after the run ends.

Is this running Phoenix or a compiled Mix project?

No, it runs a plain script evaluated by the elixir runtime. There is no application supervision tree to configure and no build step you control, so frameworks that expect a Mix project structure will not load.

Which Elixir version does XCODX run?

The Elixir version, along with the underlying Erlang/OTP version, is shown in the badge next to the editor. It is free with no signup and no local install, and each run executes in a fresh sandbox with no saved state.

How Elixir runs on XCODX

Sandbox filename
main.ex
Entry point
single main source file
Editor grammar
ruby
Reading stdin
IO.gets()
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

IO.puts "Hello from Elixir!"
IO.puts "Welcome to XCODX Online Compiler!"
message = "Elixir is functional!"
IO.puts message