What is a virtual machine? VMs explained simply
What is a virtual machine? It's a computer made of software: it runs its own operating system and apps inside a real computer, using a slice of that machine's processor, memory and storage while staying walled off from it. VMs let one PC run Linux next to Windows, and cloud providers rent them out as servers.

The short version
- A virtual machine (VM) behaves like a separate computer, with its own virtual processor, memory, storage and network connection.
- A layer of software called a hypervisor creates VMs and shares the real hardware between them.
- The real computer is the host. The operating system inside the VM is the guest.
- People use VMs to try other operating systems, test software, open risky files safely and run old apps. Cloud providers rent VMs as "instances."
- On a PC, you can run one with Hyper-V (built into Windows Pro and Enterprise), Windows Sandbox or the open source VirtualBox.
What is a virtual machine in simple terms?
Think of a VM as a pretend computer built entirely out of software. AWS describes it as an isolated system that has its own operating system and its own virtualized hardware. Google Cloud puts it in similar terms and lists what that virtual hardware includes: a processor, memory, a network interface and storage, all carved out of a real machine that other VMs may be sharing.
On a PC, a VM usually shows up as a window on your desktop, and inside that window is a whole second computer running its own programs. According to Microsoft, whatever runs in the VM is kept apart from the host, so it can't interfere with the operating system you normally use.
You'll see 2 terms often. The host is the physical computer, such as your laptop or a server in a data center. The guest is the operating system running inside the VM. One host can run several guests at once, each with its own operating system.
How does a virtual machine work?
The key piece is the hypervisor, which Microsoft also calls a virtual machine manager. AWS describes it as the software layer that coordinates how the VMs use the host's physical hardware. Microsoft says each VM is given its own portion of the host's processor, memory and storage. Google adds that several VMs can run on one host at the same time, independently of one another.
There are 2 main kinds of hypervisor:
- Type 1 (bare metal). It's installed directly on the hardware, with no operating system underneath. AWS says host computers set up this way are dedicated to running VMs. Google says this type is common in enterprise data centers, and that Google Cloud uses a hypervisor based on KVM for its Compute Engine VMs.
- Type 2 (hosted). It's installed on top of an existing operating system and works more like an ordinary app. You can switch between your normal desktop and the VM window. Oracle describes VirtualBox as this kind of hypervisor, and Google says development and testing are the most common uses.
A VM is also defined by its files. AWS compares a VM image to a "bootable blueprint": it holds the operating system, apps and settings in a form that's ready to load. Microsoft describes a VM as a computer file and says VMs are highly portable because each one is independent of the others. A VM built on one computer can be shifted to a hypervisor on another computer without much effort, according to Microsoft.
What are virtual machines used for?
Microsoft, Google and AWS list many of the same uses:
- Running another operating system. Microsoft gives the examples of a Linux VM on a Windows PC and an older version of Windows running alongside a current one. AWS mentions running Windows apps on a Mac through a Type 2 hypervisor.
- Testing software. Developers use VMs as isolated test environments that don't touch their main system.
- Handling risky files. Microsoft says a guest operating system can be used for untrusted apps to protect the host, and that VMs are useful for studying malware safely.
- Keeping old apps alive. VMs can run older software that won't work on newer operating systems. Oracle says VirtualBox may even run an old operating system the host computer no longer supports.
- Server consolidation. Companies combine several lightly used servers onto fewer physical machines. AWS gives the example of a processor that only ever runs at 25 percent of its capacity.
- Backup and disaster recovery. Microsoft says businesses back up VMs so they can restore systems quickly after a hardware failure, and that VMs can be moved to another hypervisor if the host fails.
- Learning. Microsoft says colleges use VMs to give students access to different software and operating systems without extra computers.
If you're thinking about moving from Windows to Linux, a VM is a low-risk way to try a distribution first. Our guide to Linux Mint for Windows users covers what to expect.
What is a virtual machine in cloud computing?
Docker notes that the machines a cloud provider gives you are typically VMs. AWS says a cloud instance is "just a name for a virtual machine" in the cloud: the VM runs on the provider's servers and you reach it over the internet. The provider looks after the physical hardware and the hypervisor, while you control the operating system and what runs on it.
This is what makes the cloud's shared model possible. Google says VMs let a provider divide its servers among many customers who share resources but stay isolated from one another. For the bigger picture, including the different ways companies buy cloud services, see our guide to what cloud computing is.
Cloud VMs come in types built for different jobs. Google groups them into these families:
- general-purpose VMs for a wide range of workloads;
- compute-optimized VMs for high-performance computing;
- memory-optimized VMs for large databases;
- specialized VMs with hardware such as GPUs for AI work;
- confidential VMs, which Google says keep data protected even as the processor works on it in memory.
The products have different names. Amazon's service is EC2, Microsoft sells Azure Virtual Machines and Google's is Compute Engine.
Virtual machine vs container
Containers are the other common way to isolate software, and AWS compares VMs and containers directly. The difference is how much of the system each one virtualizes.
In Docker's explanation, each VM carries a whole operating system, down to its own kernel and drivers. A container packages a single app with only what that app depends on, and it borrows the kernel of the host it runs on instead of bringing its own. Google says that makes containers lighter: they use fewer resources and start faster than VMs.
| Virtual machine | Container | |
|---|---|---|
| What it includes | A full guest operating system with its own kernel | One app and the files it needs |
| Operating system kernel | Its own | Shared with the host |
| Size and startup | Larger and slower to start | Lighter and faster to start |
| Good for | Running a different operating system, legacy apps, desktop software | New app development |
The choice isn't either-or. Docker says VMs and containers often work together. Rather than dedicating a cloud VM to a single app, you can install a container runtime on it and run several containerized apps side by side. AWS adds that not every app suits a container: software with a graphical interface or persistent storage may need reworking. For the container side of the story, see our explainers on Kubernetes and serverless computing.
How to run a virtual machine on your PC
You don't need a server to use a VM. These are the main options on a desktop or laptop.
Hyper-V on Windows
Hyper-V is Microsoft's own hypervisor. It comes with Windows, and Microsoft says there's no separate download: you switch it on as an optional feature. According to Microsoft, it needs:
- Windows 10 or Windows 11 Pro or Enterprise (it can't be installed on the Home editions);
- a 64-bit processor with Second Level Address Translation (SLAT);
- processor support for VM Monitor Mode Extension (VT-c on Intel chips);
- at least 4GB of memory.
To turn it on in Windows 11, open Control Panel, select Programs, then Programs and Features, then Turn Windows Features on or off. Check Hyper-V, select OK and restart when prompted. To make a VM, open Hyper-V Manager and choose New then Virtual Machine from the Actions pane. The wizard asks for a name, a generation, memory, a network switch and a virtual hard disk, and it can install an operating system from an .iso file. Microsoft recommends a generation 2 VM unless you have a specific reason to choose generation 1.
Windows Sandbox
Windows Sandbox gives you a throwaway Windows desktop with one-click setup, according to Microsoft. The company calls it a disposable virtual machine: every launch starts clean, and once you close it, everything you installed or saved inside is gone. Microsoft suggests it for opening untrusted files and testing new software. It works on Windows Pro, Enterprise and Education editions but not Home. Networking is on by default, and Microsoft warns that this can expose untrusted apps to your internal network. Microsoft says you can't run more than 1 sandbox at a time.
VirtualBox
Oracle's VirtualBox is an open source, cross-platform option that runs on Windows, macOS, Linux and Oracle Solaris hosts. Version 7.1 added macOS on Arm and version 7.2 added Windows on Arm. Oracle says you can create as many VMs as you like, with disk space and memory as the real constraints. It also supports snapshots, which save a VM's state so you can return to it later. The core platform package is open source under the GNU General Public License version 3, while the optional Extension Pack is licensed separately.
Don't mix hypervisors: Oracle tells users not to run VMs from 2 different hypervisors at once, because doing so can crash the whole host. Microsoft gives a similar warning: while the Hyper-V hypervisor is running, VMs managed by apps such as VMware Workstation and VirtualBox might not start or might be unreliable.
Plan for memory and disk space
Microsoft says each VM gets a share of the host's memory, and its Hyper-V instructions list enough physical memory and disk space on the host as prerequisites. Google notes that a host without enough power can slow down when it has to run a hypervisor plus several operating systems. If your PC is tight on memory, our guide to how much RAM you need can help you plan.
Frequently asked questions
Is a virtual machine free?
On a PC, you may not need to buy anything. Hyper-V and Windows Sandbox come with Windows Pro and Enterprise (Sandbox is also in Education editions), and the VirtualBox platform package is open source. Cloud VMs are a paid service: Google, for example, requires a project with billing turned on before you can create one, though new users can sign up for a free trial.
Is a virtual machine safe?
Mostly, according to Google, because keeping the guest separate from the host makes it harder for malware to jump between them. Google also says a VM is only as safe as its setup: it needs to be configured properly and kept up to date, since a poorly managed one is still open to attack. Network access matters too: Windows Sandbox, for example, is connected to the network unless you turn that off.
Does a virtual machine take up storage?
Yes. A VM lives on the host's drive, and Google says how much room it needs comes down to how big its virtual hard disk is and what's installed on it, including the operating system. Google adds that you can either reserve a set amount of space up front or let the disk take more space only as it fills up.
What's the difference between a virtual machine and a virtual desktop?
According to Google, a VM emulates a whole computer. A virtual desktop is different: it's a desktop that lives on a remote server, and you reach it over a connection instead of running it on your own machine.
What is a Java virtual machine?
It's a different kind of VM. AWS calls it a process virtual machine: instead of simulating a whole computer, it provides an environment for running programs written in a single language, so they work on almost any host. When people say "virtual machine" without qualification, they usually mean a system VM with a full operating system.
More in Cloud
- IaaS vs PaaS vs SaaS: what's the difference?
- What is cloud computing? A plain explanation
- What is Kubernetes? How it works, in plain terms
- What is serverless? Serverless computing in plain terms