Remix IDE Cheatsheet

Compiling

Use this Remix IDE reference while you build software engineering projects, review code, or refresh the syntax you reach for most.

Opening the Compiler

Click the Solidity compiler icon (looks like an S) in the left icon bar. (Ctrl+S compiles the active file; Ctrl+Shift+S compiles it and runs the open script.)

Compiler Settings

SettingWhereNotes
Compiler versionVersion dropdownPick exact version or use auto (reads pragma)
LanguageLanguage dropdownSolidity (default) or Yul
EVM VersionAdvanced → EVM Versionprague, cancun, shanghai, … — default tracks the newest fork the selected compiler supports
OptimizationEnable Optimization checkboxRuns = 200 default; raise for deploy-once contracts, lower for frequently-called
Via IRAdvanced → Via IREnables the Yul intermediate pipeline (better optimization, slower compile)
Auto compileAuto compile checkboxRecompiles on every save (Ctrl+S)
Hide warningsHide warnings checkboxSuppresses non-error diagnostics

Selecting a Compiler Version

pragma solidity ^0.8.24;   // Remix auto-selects >=0.8.24 <0.9.0
  • Auto: Remix reads the pragma and picks the latest matching release.
  • Manual: use the dropdown to pin an exact version (e.g., 0.8.24+commit.e11b9ed9).

First compile after selecting a new version downloads the compiler WASM — wait for the spinner to stop.

Compiling

  • Auto compile on — file saves trigger compilation automatically.
  • Manual — click the blue Compile \<filename\>.sol button.
  • KeyboardCtrl+S saves and (if Auto compile is on) compiles.

Reading Compiler Output

After a successful compile the button turns green. Expand the Compilation Details panel:

TabContent
ABIJSON array of function/event signatures
BytecodeDeployed bytecode (hex)
Runtime BytecodeCode stored on-chain
MetadataIPFS/Swarm hash, compiler settings
Function Hashes4-byte selectors
Gas EstimatesPer-function upper-bound gas

Click Copy ABI or Copy Bytecode to clipboard.

Errors and Warnings

ColorMeaning
Red underline + red Error — contract will not compile
Yellow underline + yellow !Warning — compiles but potential issue
Blue squiggleInfo / style hint

Hover over underlined code for the full message. Errors also appear in the Terminal with file + line references.

Common Errors

ErrorCauseFix
Source file requires different compiler versionpragma mismatchChange compiler version in dropdown
Identifier not foundMissing importAdd import statement
Stack too deepToo many local variablesUse --via-ir, split function, or use memory struct
Contract size limitBytecode > 24 KBSplit into libraries, optimize, or enable --via-ir
SPDX license identifier not providedMissing headerAdd // SPDX-License-Identifier: MIT

Optimization Examples

// For a contract deployed once and called many times (e.g., ERC-20)
// Optimizer runs: 200 (default) — good balance

// For a factory deployed rarely but instances called often
// Optimizer runs: 1 (minimize deploy cost)

// For a library called millions of times
// Optimizer runs: 100000 (minimize runtime cost)

Set runs in Advanced Configurations → Optimization → Runs.

Exporting Artifacts

After compile, artifacts (ABI + bytecode JSON) are written to artifacts/<ContractName>.json in the workspace. Use these with ethers.js / web3.js:

const artifact = require('./artifacts/Hello.json');
const factory = new ethers.ContractFactory(artifact.abi, artifact.bytecode, signer);