When you start learning to code, one of the first questions is: where do I actually write it? You could use a plain text editor like Notepad, but you’d quickly miss things like color-coded code, error warnings, and a way to run your program with one click.

That’s why so many beginners, and professional developers, use Visual Studio Code, usually just called VS Code. It’s free, it runs on every major operating system, and it works with almost any programming language. In this guide, you’ll learn what VS Code is, how to install it, how to find your way around, and how to write and run your first program.

What Is Visual Studio Code?

Visual Studio Code is a free code editor made by Microsoft. It runs on Windows, macOS, and Linux, and it’s one of the most popular development tools in the world.

Out of the box, VS Code is a fast, lightweight editor with features made for code:

  • Syntax highlighting: keywords, text, and numbers in different colors, so code is easier to read.
  • IntelliSense: smart suggestions that complete names and show you what a function expects as you type.
  • Error highlighting: red and yellow squiggly lines under problems, before you even run your code.
  • A built-in terminal, Git integration, and a debugger.

What makes it so flexible is its extensions: free add-ons from its marketplace that add support for specific languages and tools. With the right extensions, the same editor works for Python, HTML and CSS, JavaScript, SQL, Docker, and much more.

The core of VS Code is open source (the project is called Code - OSS and is published on GitHub under the MIT license), while the version you download from Microsoft adds Microsoft’s branding and a few extras under its own license. Either way, it’s free for personal and commercial use.

VS Code vs. Visual Studio vs. Other Editors

The names cause a lot of confusion, so here’s a quick comparison:

ToolWhat it isBest for
Visual Studio CodeA lightweight, free code editor that you extend with extensionsAlmost everything: web development, Python, scripting, data, learning
Visual StudioMicrosoft’s full IDE (integrated development environment), mainly for WindowsLarge .NET, C#, and C++ applications
Notepad / TextEditPlain text editorsQuick notes, not real coding
PyCharm, IntelliJFull IDEs for specific languagesLarge projects in one language

An IDE includes everything for one kind of development in one big package. VS Code starts small and lets you add only what you need, which makes it fast and beginner-friendly. They’re different products: if a tutorial says “Visual Studio,” check whether it means VS Code before you download the wrong one.

How to Install VS Code

  1. Go to the official site, code.visualstudio.com, and download the version for your operating system. Only download it from there, not from third-party download sites.
  2. Install it:
    • Windows: run the installer. When it asks about additional tasks, keep Add to PATH checked, and consider checking “Open with Code” for files and folders. This adds a handy right-click option in File Explorer.
    • macOS: open the downloaded file and drag Visual Studio Code into your Applications folder.
    • Linux: install the .deb package (Ubuntu, Debian) or the .rpm package (Fedora, Red Hat), or use your distribution’s software store.
  3. Open VS Code. A Welcome page walks you through choosing a theme and a few basics.

Open VS Code From the Terminal

The code command lets you open any folder in VS Code from the terminal:

code .

The . means “the current folder.” On Windows and Linux, the installer sets this up for you. On a Mac, open VS Code, press Cmd + Shift + P, type shell command, and run the command that installs code in PATH (in recent versions it’s called Shell Command: Install ‘code’ and optionally ‘copilot’ commands in PATH). Then restart your terminal.

A Tour of the VS Code Interface

When you open a folder, VS Code is divided into five main areas:

  1. Activity Bar (the narrow strip of icons on the far left): switches between views like the Explorer, Search, Source Control, Run and Debug, and Extensions.
  2. Side Bar: shows the selected view. Most of the time, that’s the Explorer, with the files and folders of your project.
  3. Editor: the large area where you write code. You can open files in tabs and split the editor to see two files side by side.
  4. Panel (at the bottom): holds the Terminal, Problems (a list of errors and warnings), Output, and the Debug Console.
  5. Status Bar (the thin bar at the very bottom): shows information like the current line, the file’s language, and, for Python, which Python version the project is using.

The Command Palette: The Most Useful Shortcut

If you remember only one shortcut, make it this one: Ctrl + Shift + P (Cmd + Shift + P on a Mac). It opens the Command Palette, a search box for every command in VS Code. Type what you want, like “theme,” “format,” or “terminal,” and pick it from the list. You never have to hunt through menus.

Your First Project: Hello, World in Python

Let’s write and run a small Python program. You’ll need Python installed on your computer (if you’re new to Python, start with Python Basics: What Every Beginner Should Know).

1. Open a folder. Create a new folder called hello-vscode, then in VS Code choose File → Open Folder and select it. VS Code works best when you open a folder (your project), not single files.

Workspace Trust: the first time you open a folder, VS Code asks whether you trust the authors of its files. For your own folders, choose Yes, I trust the authors. For code downloaded from the internet that you haven’t reviewed, choosing No opens it in Restricted Mode, which blocks code from running automatically.

2. Install the Python extension. Click the Extensions icon in the Activity Bar (or press Ctrl + Shift + X), search for Python, and install the one published by Microsoft. VS Code often suggests it automatically when you open a Python file.

3. Create a file. In the Explorer, click the New File icon and name it hello.py. The .py ending tells VS Code it’s a Python file, so it turns on the right colors and suggestions. Type:

name = input("What's your name? ")
print(f"Hello, {name}! Welcome to VS Code.")

4. Run it. Click the Run button (the ▷ triangle) in the top-right corner of the editor. VS Code opens the terminal at the bottom and runs your program. Type your name and press Enter:

What's your name? Ana
Hello, Ana! Welcome to VS Code.

That’s it: you wrote and ran a program without leaving the editor.

You can also run it yourself in the integrated terminal. Open it with Ctrl + ` (the backtick key, usually below Esc), then type python hello.py (or python3 hello.py on macOS and Linux).

Tip: if VS Code asks you to select a Python interpreter, it’s asking which Python installation to use. Click the Python version in the Status Bar, or run Python: Select Interpreter from the Command Palette. If your project has a virtual environment, choose that one. (See Python Virtual Environments: Setup Guide & Best Practices.)

Extensions Worth Installing

Extensions are what turn VS Code into the right tool for your work. Start with the ones that match what you’re learning:

ExtensionWhat it does
Python (Microsoft)Running, debugging, IntelliSense, and virtual environments for Python
Jupyter (Microsoft)Opens and runs Jupyter notebooks right in VS Code (see What Is Jupyter Notebook?)
Rainbow CSVShows each column of a CSV file in a different color, so data is easy to read, and can align columns and check for formatting errors. Try it with the practice files from SQL and Data Science Interview Questions
Live ServerOpens your HTML page in a browser and reloads it every time you save
PrettierFormats HTML, CSS, JavaScript, and more automatically
ESLintFinds problems in JavaScript code
Container Tools / Docker (Microsoft)Work with Docker containers and Dockerfiles
Remote - SSH (Microsoft)Edit files on a remote server as if they were on your computer
Spanish Language Pack (Microsoft)Shows VS Code’s menus and messages in Spanish

Install extensions carefully. Extensions can run code on your computer, just like any program. Prefer extensions from verified publishers (they have a check mark next to their name), with many installs and recent updates, and install only what you actually use.

Keyboard Shortcuts Every Beginner Should Know

ActionWindows / LinuxMac
Command PaletteCtrl + Shift + PCmd + Shift + P
Open a file by name (Quick Open)Ctrl + PCmd + P
Show or hide the terminalCtrl + `Ctrl + `
Show or hide the Side BarCtrl + BCmd + B
Comment or uncomment a lineCtrl + /Cmd + /
Move a line up or downAlt + ↑ / ↓Option + ↑ / ↓
Copy a line downShift + Alt + ↓Shift + Option + ↓
Select the next match of a wordCtrl + DCmd + D
Rename a variable everywhereF2F2
Format the whole fileShift + Alt + FShift + Option + F
Go to a line numberCtrl + GCtrl + G
Search in all filesCtrl + Shift + FCmd + Shift + F
Split the editorCtrl + \Cmd + \
Open SettingsCtrl + ,Cmd + ,
Start debuggingF5F5

A few shortcuts are different on Linux. To see or change any shortcut, open Keyboard Shortcuts with Ctrl + K then Ctrl + S (Cmd + K, Cmd + S on a Mac).

One more trick: multiple cursors. Hold Alt (Option on a Mac) and click in several places to type in all of them at once. Combined with Ctrl + D, it’s a fast way to edit repeated text.

Built-In Features You’ll Use Every Day

  • IntelliSense: start typing and VS Code suggests names, functions, and their parameters. Press Tab or Enter to accept a suggestion.
  • Problems panel: errors and warnings appear as squiggly lines in your code and as a list in the Problems panel. Click one to jump to it.
  • Debugger: click to the left of a line number to set a breakpoint (a red dot), then press F5. Your program stops at that line, and you can inspect every variable’s value. It’s far more useful than adding print() everywhere.
  • Source Control: VS Code has Git built in. The Source Control view shows what changed in each file, and lets you stage, commit, and push without typing Git commands. Learning the commands first still helps; see Mastering Git: Basic Commands for Version Control.
  • Emmet for HTML: in an .html file, type ! and press Tab (or Enter) to generate a complete HTML page structure instantly. (New to HTML? See How to Use HTML and CSS: A Beginner’s Guide.)
  • Auto Save: turn on File → Auto Save so you never lose work or run an old version by accident.

Customizing VS Code

Themes

Press Ctrl + K then Ctrl + T (Cmd + K, Cmd + T on a Mac) to preview and choose a color theme. You can install more themes from the Extensions view.

Settings

Open Settings with Ctrl + , (Cmd + , on a Mac). You can search for any setting, like “font size” or “word wrap,” and change it with a click.

Behind the scenes, VS Code stores your settings in a file called settings.json. To edit it directly, run Preferences: Open User Settings (JSON) from the Command Palette. Here’s a beginner-friendly starting point:

{
    "editor.fontSize": 16,
    "editor.wordWrap": "on",
    "editor.formatOnSave": true,
    "files.autoSave": "afterDelay",
    "workbench.colorTheme": "Default Dark Modern"
}

This makes the text a bit bigger, wraps long lines so you don’t scroll sideways, formats the file every time you save (if you have a formatter installed), saves automatically, and uses the default dark theme.

Settings Sync and Profiles

  • Settings Sync saves your settings, extensions, and shortcuts to your Microsoft or GitHub account, so a new computer is set up in seconds. Turn it on from the Accounts icon at the bottom of the Activity Bar.
  • Profiles let you keep separate setups, for example one with Python extensions for data work and another with web extensions. Manage them from File → Preferences → Profiles (Code → Settings → Profiles on a Mac).

AI Features in VS Code

VS Code includes AI features through GitHub Copilot: code suggestions as you type, a Chat view where you can ask questions about your code, and agents that can make changes across several files. If you sign in with a GitHub account without a paid subscription, you get the Copilot Free plan, which includes a monthly allowance.

AI can be a great helper, but when you’re learning, it can also do the thinking for you. A good approach:

  • Try first, then ask. Write your own solution, and use the AI to explain errors or review what you wrote.
  • Read every suggestion before accepting it, and make sure you understand it.
  • Turn it off if you’d rather learn without it. Search for Disable AI Features in Settings (the chat.disableAIFeatures setting). You can turn it off for everything, or only for a specific project.

Going Further

When you’re comfortable with the basics, VS Code grows with you:

  • Remote - SSH: edit and run code on a server, like a VPS or a Raspberry Pi, from your own computer. (See What Is SSH?.)
  • Dev Containers: develop inside a Docker container, so every project has exactly the tools it needs. (See Docker for Beginners.)
  • WSL: on Windows, write code inside a real Linux environment.
  • vscode.dev: a version of VS Code that runs in your browser, with nothing to install. It’s handy for quick edits on any computer, though it can’t run a terminal or most programs.

Common Beginner Mistakes

  • Opening single files instead of a folder. Many features, like the Explorer, Search, and Git, work on the folder you opened. Always use File → Open Folder for a project.
  • Forgetting to save. A white dot on a tab means the file has unsaved changes. Press Ctrl + S (Cmd + S), or turn on Auto Save.
  • Running the wrong Python. If a package you installed “isn’t found,” check the interpreter in the Status Bar.
  • Installing too many extensions. Each one can slow VS Code down or conflict with another. Install what you need, and remove what you don’t use.
  • Confusing VS Code with Visual Studio. They’re different products, as explained above.

Conclusion

Visual Studio Code is a free, fast, and flexible code editor that works for almost any language. You learned how to install it, find your way around its interface, write and run your first Python program, add the right extensions, and work faster with the Command Palette and keyboard shortcuts.

The best way to get comfortable is to use it every day. Open a folder, create a file, and start building something small: a calculator, a web page, a script that renames your photos. VS Code will be there for every step, from your first print() to your first real project. (Ready for a web project? See Learn JavaScript: A Beginner’s Guide.)