Swelıty
Tools for everyone

Free Online Rust Playground

Write Rust code and run it, with the output shown in a console. Your code is sent to a free online service to be compiled and run.

Press Run, or Ctrl or Cmd + Enter, to run your code. The output is shown in Console. Rust runs on a remote server, so it needs a connection, can be busy, and can take several seconds to answer. It stops after 90 seconds. Input is not available.

main.rs

Preview

Console

Output appears here. Press Run, then try console.log("Hello")

As with any online tool, we highly recommend not including sensitive data in your code, such as passwords, API keys or other secrets.

How to use

  1. Write your program in main.rs with an fn main function.

  2. Press Run, or Ctrl or Cmd + Enter. The output appears in the Console panel.

  3. If it does not compile, read the compiler's message in the console. It usually names the line and suggests a change.

  4. Print with println!, and keep test values in the code because there is no keyboard input.

  5. Download a zip with main.rs and a page that records the last output.

Why use this tool

  • A recent stable Rust

    The newest stable release the service lists is chosen at each run, and its name is shown with the result.

  • Compiler messages

    Borrow checker and type errors from rustc are shown in the console.

  • Starter program

    The example shows enums, pattern matching, a HashMap and sorting with a custom order.

About this tool

Compile and run a Rust program online without installing rustup or Cargo. The starter code defines an enum with data, uses match to work out areas, and counts words with a HashMap before sorting them, which is a handy base for practising ownership, borrowing, traits and iterators. Rust cannot run inside this page, so when you press Run your code is sent to a free online code-running service, which compiles it and returns the output. Never paste passwords, API keys or other secrets.

Frequently asked questions

Yes. When you press Run, your code is sent from your browser to Wandbox (wandbox.org), a free community service that runs it and sends back the output. Like any website, it also receives your IP address. Do not include passwords, API keys, private data or other secrets.

No. Only the Rust standard library is available. There is no Cargo.toml and nothing can be added from crates.io.

Rust checks that a value is not used after it has moved and is not changed while something else borrows it. The compiler message shows both places. Try borrowing with &, cloning the value or shortening how long a borrow lasts.

No. The playground runs your main function. Call the code you want to check from main and use assert! or assert_eq!.

Compiling can take several seconds. The playground stops waiting after 90 seconds, and the service can sometimes be busy.