How to Create a Smart Contract Using Remix
Remix is a free browser IDE for writing, compiling and deploying Solidity contracts. Here is the full path from a blank file to a contract on a test network.
On this page
Short answer
Remix is a browser-based development environment for writing, compiling, testing and deploying smart contracts written in Solidity. You open it at remix.ethereum.org, write a contract in the editor, compile it with the Solidity compiler plugin, and deploy it first to the built-in Remix VM and then to a test network through a browser wallet.
What is Remix?
Remix is a browser-based integrated development environment for writing, compiling, testing and deploying smart contracts, mostly written in Solidity for Ethereum and other EVM chains.
It runs entirely in the browser at remix.ethereum.org, so there is nothing to install to start. The editor offers syntax highlighting, auto-compile on save, a file explorer, a terminal and plugins for compiling, deploying, debugging and testing. A default example contract is waiting when you first open it, so you can deploy something within minutes.
Remix is aimed at learning and small builds rather than large codebases. Teams that outgrow it usually move to a local setup with a framework, but Remix stays the fastest way to try an idea or check a piece of Solidity. For the wider picture, see what smart contract development is.
What do you need before you start?
Before you start you need a browser, a small amount of test ether if you plan to deploy to a test network, and a basic grasp of Solidity syntax.
The browser is enough for the first steps, because Remix ships with its own sandbox chain. For a test network you need a browser wallet such as MetaMask, switched to a test network, with test ether from a faucet. Test ether has no value, so mistakes cost nothing but time.
You do not need a local Node.js install, a code editor or a build tool to follow this guide. Those become useful later, when the contract grows past a few files or needs automated tests. Keep the first contract small: a single file with one contract is the right size for learning the flow.
How do you write a contract in Remix?
You write a contract in Remix by creating a new Solidity file in the file explorer, adding a licence line and a pragma, then writing the contract code in the editor.
- Open remix.ethereum.org. The workspace loads with a contracts folder and an example file.
- Create a new file. Use the new-file button in the file explorer and name it with a .sol ending, for example SimpleStore.sol.
- Add the licence and pragma. Start with a licence line such as // SPDX-License-Identifier: MIT and a pragma line such as pragma solidity ^0.8.24; so the compiler knows which version to use.
- Write the contract. Declare the contract, its state variables and its functions. Keep it short: a value to store, a function to set it and a function to read it.
- Save the file. Remix saves to browser storage as you type, and auto-compile will flag errors in the editor.
A simple storage contract is the standard first example because it covers the whole flow: a variable, a function that changes it, a function that reads it, and a transaction that costs gas. Once that works, the same steps apply to a token or a voting contract. For how tokens are built, see how to create an ERC-20 token.
How do you compile a contract in Remix?
You compile a contract in Remix with the Solidity Compiler plugin, which turns the source code into bytecode and an ABI that the deploy step needs.
Open the compiler panel from the left sidebar and pick the compiler version that matches your pragma line. Remix usually suggests the right one. Press Compile, or turn on auto-compile so every save rebuilds the contract. Errors appear in the panel with a line number, and warnings appear beside them.
Two settings matter for real deployments. The optimiser setting can reduce gas costs but changes the bytecode, so a contract compiled with different settings is a different deployment. The EVM version setting controls which chain features the compiler may use, and it should match the network you deploy to. For a first contract, the defaults are fine.
The ABI is a JSON list of the contract's functions, inputs and outputs. Remix shows it in the compilation details, and any app that talks to the contract needs it. Keep the compiled contract and its ABI together, and note the exact compiler version used, so the same source always produces the same result.
How do you deploy and test a contract in Remix?
You deploy a contract in Remix from the Deploy and Run panel, after choosing an environment, and you test it by calling its functions from the panel that appears below.
| Environment | What it is | When to use it |
|---|---|---|
| Remix VM | Sandbox chain in the browser | First tests, free, 10 accounts with 100 ETH each |
| Browser Extension | Your wallet, such as MetaMask | Deploying to a test network or mainnet |
| WalletConnect | A mobile or desktop wallet | Deploying from a wallet that is not a browser extension |
| Local node | A node running on your machine | Testing against a local chain you control |
Start with the Remix VM. Select your contract, press Deploy, and the contract appears under Deployed Contracts with its functions listed. Call the read function to see the stored value, then call the write function with a new value and read it again. Nothing leaves your browser, and nothing costs real money.
When the contract behaves as expected, switch the environment to Browser Extension, connect your wallet, pick a test network, and deploy again. This time the deploy is a real transaction: it costs test ether and takes a few seconds to confirm.
You can then load the deployed contract in Remix by pasting its address, or look it up on a block explorer for the test network. For the deployment step in detail, see how to deploy smart contracts on Ethereum.
Example: a simple loyalty token in Remix
Example (hypothetical): a coffee shop wants a loyalty token, so a developer opens Remix, writes a token contract, and tests it in the Remix VM before showing it to anyone.
The contract gives the shop 1,000,000 tokens in total. It assigns 600,000 to customer rewards, 300,000 to the shop's own reserve, and 100,000 to staff bonuses. The three shares add up: 600,000 + 300,000 + 100,000 = 1,000,000, so every token is accounted for before a single transfer happens.
In the Remix VM the developer deploys the contract, sends 50 tokens to a test account, and checks the balance reads 50. Then the developer sends 200 tokens to a second account and checks that the first account now holds 50 + 200 = 250 tokens.
The shop's reserve has fallen by the same 250, so the numbers match on both sides. That is the check that matters: a token contract must never create or destroy tokens by accident.
What are the common mistakes?
The most common mistakes when creating a smart contract in Remix are deploying untested code, using the wrong network, and losing track of which compiler version produced a deployment.
- Deploying to mainnet from a first draft. Test in the Remix VM, then on a test network, then review the code before any real deployment.
- Connecting a wallet to the wrong network. Check the network name in the wallet before pressing Deploy, because a mainnet deploy costs real ether.
- Ignoring compiler warnings. A warning is not an error, but it often points at a real problem, such as an unused variable or a risky conversion.
- Changing the compiler version between builds. Different versions can produce different bytecode, so record the version used for each deployment.
- Testing only the happy path. Call the contract with wrong inputs and from the wrong account, because that is what attackers and careless users will do.
- Keeping secrets in the contract. Everything on chain is public, so never put a password or a private key in the source code.
Key takeaways
- Remix is a free browser IDE for Solidity contracts, with no install needed to start
- Write the contract, compile it, then deploy first to the Remix VM sandbox
- The compiler version and optimiser settings change the bytecode, so record them
- Test on a test network through a browser wallet before any real deployment
- Check token arithmetic on both sides of every transfer before shipping
Frequently asked questions
What is Remix IDE?
Remix IDE is a browser-based development environment for writing, compiling, testing and deploying smart contracts, mostly in Solidity. It runs at remix.ethereum.org with no install, and it includes an editor, a Solidity compiler, a deploy panel and a debugger. It is aimed at learning and small builds, while larger projects usually move to a local framework.
Is Remix free to use?
Yes. Remix itself is free and runs in the browser, and testing in the Remix VM costs nothing because the sandbox chain runs locally in your browser. Deploying to a test network costs test ether, which comes free from a faucet, and deploying to a main network costs real ether for gas. The tool charges nothing at any stage.
Which language do you write contracts in with Remix?
Solidity is the main language in Remix, and it is the language most Ethereum smart contracts are written in. Remix also supports Vyper through a plugin, and it can work with contracts written for other EVM-compatible chains. The steps in this guide, writing, compiling and deploying, are the same for either language.
Can I deploy a contract from Remix to a real network?
Yes. Switch the environment in the Deploy and Run panel to Browser Extension, connect a wallet such as MetaMask, and pick the network you want. The deploy becomes a real transaction that costs gas in that network's currency. Always test the same contract on a test network first, and check the network name in your wallet before you confirm.
What is the Remix VM?
The Remix VM is a sandbox blockchain that runs inside your browser. It comes with 10 accounts, each loaded with 100 test ETH, and transactions need no approval and cost nothing. It is the right place for first tests because nothing leaves your browser and mistakes are free. When the contract works there, move to a test network.
What is the ABI, and why does it matter?
The ABI is a JSON description of a contract's functions, inputs and outputs, produced by the compiler alongside the bytecode. Any app or script that talks to the contract needs the ABI to know how to call it. Remix shows it in the compilation details, and you should keep it with the contract address for every deployment.