Solidity Online Compiler

About the Solidity compiler

Write Ethereum smart contracts. Compiled in your browser. Run Solidity code in your browser with no install and no signup — the editor, the input and the output share one screen. Solidity compiles and runs on your own device through WebAssembly, so once the page has loaded it keeps working without a network connection.

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 Solidity example

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

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract StudentRegistry {
    struct Student {
        string name;
        uint256 score;
        bool exists;
    }
    mapping(address => Student) public students;
    address[] public studentList;
    event StudentAdded(address indexed addr, string name, uint256 score);
    function addStudent(string memory _name, uint256 _score) public {
        require(_score <= 100, "Score must be <= 100");
        require(!students[msg.sender].exists, "Already registered");
        students[msg.sender] = Student(_name, _score, true);
        studentList.push(msg.sender);
        emit StudentAdded(msg.sender, _name, _score);
    }
    function getStudentCount() public view returns (uint256) {
        return studentList.length;
    }
    function getTopStudent() public view returns (string memory, uint256) {
        require(studentList.length > 0, "No students");
        address topAddr = studentList[0];

The editor opens with the full program.

More Esoteric & Educational compilers

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