About this Ruby compiler
This free online Ruby compiler lets you write, run and test Ruby 3.4 programs without installing anything. Type your code, press Run, and the output appears next to the editor.
Ruby runs inside your browser using a WebAssembly build of the official interpreter, so there is no account to create and your code is not sent to a server to be executed. It is handy for trying a method, practising blocks and classes, or checking a snippet.
How to use it
- Write or paste your Ruby code in the editor on the left.
- If your program calls gets, type the values in the Input box below the output, one per line, in the order the program asks for them.
- Press Run (or Ctrl + Enter). The first run loads Ruby (about 9 MB, kept by your browser afterwards), so it takes a few seconds.
- Read the output on the right. Errors show the file and line number with the usual Ruby message.
Features
- Ruby 3.4 with its standard library, including json, set, time and more
- Reads keyboard input through the Input box with gets
- Errors with line numbers and a short backtrace
- A fresh Ruby VM on every run, so nothing carries over by accident
- No login, no install, works on any modern device
- Dark and light themes, automatic saving, download as .rb
Good to know
- Only Ruby's built-in standard library is available. Extra gems cannot be installed.
- There is no network access or files that last between runs.
- Input is given before the program starts, not typed while it runs.
- A program that runs for more than 30 seconds is stopped.
Frequently asked questions
Which version of Ruby is this?
Ruby 3.4, the official CRuby interpreter compiled to WebAssembly so it runs in your browser.
How do I give my Ruby program input?
Type the values into the Input box below the output, one per line, then press Run. gets and $stdin.gets read from it.
Can I install gems or require other libraries?
Only the standard library that ships with Ruby, such as json, set, date and time, can be required. Gems cannot be installed in this online compiler.
Why does the first run take longer?
The Ruby interpreter is downloaded and prepared on the first run. Your browser keeps it afterwards, so later runs on the same device are quicker.
Is it free?
Yes. There is no sign-up, and nothing is executed on our servers.