
Compile Arduino Core Based ESP32 Projects in Visual Studio Code
Learn how to configure Visual Studio Code to compile and upload ESP32 projects using the Arduino Community Edition plugin and Arduino CLI - no Arduino IDE needed.
If you already live in Visual Studio Code, switching to the Arduino IDE just to compile a sketch feels like a step backward. The Arduino IDE's "Use External Editor" option lets you write code in VS Code, but you are still bouncing between two apps every time you build or upload. You do not need to - VS Code can handle editing, compiling, and uploading for ESP32 Arduino-core projects on its own. See VS Code vs Arduino IDE for ESP32 development for the fuller comparison; this guide covers the setup itself.
About the extension this guide uses. Microsoft's original VS Code Arduino extension was archived and pulled from the Marketplace in October 2024, after a critical remote-code-execution vulnerability was disclosed against it (CVE-2024-43488). Arduino Community Edition, the community fork this guide walks through, is what replaced it - but it has stayed on version 0.7.2 since (the same version the screenshots below show), a release the Marketplace's own version history dates to September 2024. Its GitHub repository is not archived and still receives occasional commits (a maintainer resurfaced in late August 2026 after a long quiet stretch), and an open pull request there addresses a related command-execution issue, but that fix has not shipped as a new Marketplace version as of this update. Install it if you want the point-and-click board/port pickers and IntelliSense, but do not treat it as a long-term dependency: arduino-cli, which does the actual compiling and uploading underneath, is maintained directly by Arduino and updated independently of whatever state the extension is in. If the extension ever stops working entirely, the CLI commands later in this guide still work from a plain terminal.
Looking for PlatformIO? That is a different (and more integrated) route to ESP32 development in VS Code, with its own project format and build system - covered in our PlatformIO ESP32 setup guide.
1Install VS Code
Grab the installer for your OS from the official VS Code website.
Windows
Download the installer and run it. VS Code launches from the Start menu afterward.
macOS
With Homebrew:
brew install --cask visual-studio-code
Linux
Download the .deb/.rpm package from the website, or install via your distro's package manager.
Launch it once it is installed - the next steps add the extensions and settings that get it ready for ESP32 development.
2Install the Arduino Community Edition extension
- Click the Extensions icon in the left sidebar (four small blocks).
- Search for
Arduino Community Edition. - Click Install on the result published by vscode-arduino.

This is the community-maintained continuation of Microsoft's original Arduino extension - it gives you compiling, uploading, and serial monitoring for .ino sketches from inside VS Code, backed by either the legacy Arduino IDE or, better, arduino-cli.
3Install arduino-cli
The extension can run against either backend, but arduino-cli is the one worth using: it is more stable with ESP32 boards, and it is the backend the extension itself is moving toward - support for the legacy Arduino IDE backend is planned for removal in a future version.
Windows
Download the installer or ZIP archive from the Arduino CLI releases page and add it to your PATH so VS Code can find it.
macOS
With Homebrew:
brew install arduino-cli
Linux
The official install script:
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
Confirm it is installed:
arduino-cli versionA version string means you are good to go.
4Point the extension at arduino-cli
The extension needs the full path to the arduino-cli binary, not just the command name.
Windows
In Command Prompt or PowerShell:
where arduino-climacOS / Linux
which arduino-cliWith Homebrew, that path is typically:
/opt/homebrew/bin/arduino-cli
Copy that path - you need it for the extension settings below.
Skipping this step is also an option. The extension bundles its own copy of arduino-cli and can use it out of the box - leave Arduino: Path empty and just enable Arduino: Use Arduino CLI. Pointing it at the CLI you installed yourself, as this guide does, keeps the extension in sync with whatever version you use directly in a terminal or other tools.
Open the Arduino Community Edition settings in VS Code and find Arduino: Path.

Paste the path to the arduino-cli binary you found above. On macOS with Homebrew, that is typically:
/opt/homebrew/bin/arduino-cliThen find Arduino: Use Arduino CLI and check it - this switches the extension from the legacy Arduino IDE backend to arduino-cli.

Restart VS Code so the new settings take effect.
Set up your project folder
Create a new folder for your project, and inside it a .ino file with the same name as the folder - the Arduino build system expects this.
test/
test.inoOpen that folder in VS Code (File → Open Folder..., or drag it into the window).
5Select the ESP32 board and port
With the extension and CLI configured, three new items appear in the status bar at the bottom of VS Code: <Select Programmer>, <Select Board Type>, and <Select Port>.
Status bar items not showing? They sometimes only appear after you trigger a sketch. Open the Command Palette (CMD + Shift + P on macOS, Ctrl + Shift + P on Windows/Linux) and run Arduino: Select Sketch first.
Click <Select Board Type> in the status bar.

A new tab opens with the board list:

Pick the ESP32 board you are using - it should match the name from the Arduino Core for ESP32, such as ESP32 Dev Module or ESP32-S3-DevKitC-1. Not sure which entry fits your board? Every page in the boards database lists its exact Arduino entry. Here, ESP32S3 Dev Module (ESP32) is selected:

Then click <Select Port> and pick the port your board is connected to.
Set the build output location
Your project folder now includes a hidden .vscode directory with an arduino.json file - the extension's per-project settings. Open it and add an output key:
"output": "build"
Without this key, the extension recreates a temporary output folder on every build, so nothing carries over between compiles. Setting output keeps compiled binaries and intermediate files in a build subfolder inside the project instead, which lets the extension reuse them and speeds up repeat builds. The extension's own documentation notes that this folder is best kept outside the workspace entirely - in practice, a plain subfolder name like build, as used here, is what most setups use without issue.
6Verify and upload
Open the Command Palette (CMD + Shift + P on macOS, Ctrl + Shift + P on Windows/Linux) and run Arduino: Verify to build your sketch.

The extension uses arduino-cli to compile the .ino file against the board you selected. On success, a build folder appears in your project directory with the compiled output:

To upload: connect the board over USB, confirm the port is selected in the status bar, then run Arduino: Upload from the Command Palette.

The output panel at the bottom shows the upload progress. Once it finishes, your program is running on the ESP32 - the same result as the Arduino IDE, without ever opening it.
From here, two guides worth a look: ESP-IDF vs Arduino Core if you want to know what you would gain by dropping the Arduino APIs entirely, and using ESP-IDF with VS Code if you decide to make that move. For a project to build next, try sending a message from ESP32 to Discord or an RGB LED color picker over WebSocket. And if your board has two USB ports and you have wondered why, this post explains it.
