Crystal Online Compiler

About the Crystal compiler

Ruby-like syntax with C speed. Compiled online. Run Crystal code in your browser with no install and no signup — the editor, the input and the output share one screen. Crystal is executed by a remote runtime: your code is submitted to it and the output is returned to this page.

Press Run to execute the program, edit it and press Run again, or paste your own code over it. Everything you type stays in the page; the editor caches your work locally so a reload does not lose it.

A Crystal example

This is the program the Crystal editor opens with — run it as it is, then change it.

struct Student
  getter name : String
  getter scores : Array(Int32)
  def initialize(@name, @scores)
  end
  def average : Float64
    scores.sum.to_f / scores.size
  end
  def grade : String
    case average
    when 90.. then "A"
    when 80.. then "B"
    when 70.. then "C"
    else           "D"
    end
  end
end
students = [
  Student.new("Alice", [92, 88, 95]),
  Student.new("Bob", [87, 91, 83]),
  Student.new("Charlie", [95, 90, 98]),
  Student.new("Diana", [78, 82, 75]),
]
puts "Crystal Student Report"

The editor opens with the full program.

More Systems & Low-Level compilers

Browse all 109 languages — the same editor runs each of them, in the browser or on a shared runner.