Install R on Windows using the CRAN Windows installer

In this tutorial, we shall install R on Windows using the official CRAN Windows installer. The same basic steps work for Windows 10 and Windows 11: download the installer, run the setup wizard, keep the default options unless you have a specific reason to change them, and verify the installation from Command Prompt.

R is the programming language and runtime used to run R scripts and packages. RStudio is a separate editor/IDE that many learners install after R is already working. If you are just starting with R programming on Windows, install R first and check that the R or Rscript command works before installing any additional tools.

Before downloading R for Windows

Before you begin the R installation on Windows, check the following points.

  • Use the official CRAN Windows download page for the installer.
  • Download the current R-x.y.z-win.exe file, where x.y.z is the current R version number shown on CRAN.
  • Close any old R sessions before upgrading an existing R installation.
  • Use a Windows account that is allowed to install applications. On some computers, administrator permission may be required.
  • Remember that the screenshots below may show an older R version number, but the installation flow is similar for current Windows installers.

Step-by-step process to install R on Windows 10 or Windows 11

Following is a step by step process to install R programming language on Windows.

  1. Download R-n.n.n-win.exe from https://cran.r-project.org/bin/windows/base/. The exact file name and file size may change when a new R version is released.
  2. Once downloaded, double click on the exe file to run.
    Install R on Windows
    Click on Run.
  3. Continue with the default steps. For Startup Options, Select No for the default options. You may select Yes and provide necessary information. But in this tutorial, we shall proceed with default options.
    Install R on Windows
  4. Once the setup is completed, R is successfully installed in your Windows computer. You may have to add path of Rscript.exe to Path environment variable.
    Edit System Environment variable, Path, and append the path to Rscript.exe (in this case C:\Program Files\R\R-3.4.3\bin).
    Install R on Windows
  5. Open a command prompt and run the command Rscript.
    Install R on Windows - Rscript

Add R and Rscript to the Windows PATH environment variable

In many recent R for Windows installations, the installer can make R available from the Start menu even if the command line PATH is not configured. If you want to run R commands from Command Prompt, PowerShell, VS Code, batch files, or scheduled tasks, add the R bin folder to the Windows PATH.

The folder usually follows this pattern:

</>
Copy
C:\Program Files\R\R-x.y.z\bin

Replace R-x.y.z with the installed R version folder on your computer. For example, if R is installed under C:\Program Files\R\R-4.4.0, the PATH entry should point to C:\Program Files\R\R-4.4.0\bin.

To add this path in Windows, open Environment Variables, edit the Path variable for your user or system, add the R bin folder, and then open a new Command Prompt window. A Command Prompt window that was already open may not read the updated PATH.

Check the R installation from Windows Command Prompt

After installing R on Windows, verify the installation with a version command. Open a new Command Prompt and run the following command.

</>
Copy
Rscript --version

If the PATH is set correctly, Windows prints the installed Rscript version. The version number depends on the R release you installed.

Rscript (R) version x.y.z

You can also start R directly from the command line.

</>
Copy
R --version

Install an R package in Windows after setup

After R is installed, you can install packages from inside the R console. For example, the following command installs the jsonlite package from CRAN.

</>
Copy
install.packages("jsonlite")

When R asks you to choose a CRAN mirror, select a nearby mirror or accept the default mirror suggested by R. If package installation fails on an office or school computer, check whether a proxy, firewall, or restricted user permission is blocking downloads or writes to the R library folder.

Optional RStudio installation after R works on Windows

RStudio is optional, but it is commonly used because it provides a script editor, console, environment pane, plots pane, and package tools in one interface. Install R first, verify that R works, and then install RStudio Desktop if you want an IDE for writing and running R programs.

If RStudio cannot find R, restart Windows once, confirm that R is installed in C:\Program Files\R\, and check whether your PATH points to the correct R version folder.

Fix common R installation issues on Windows

Issue on WindowsLikely reasonWhat to check
Rscript is not recognizedR bin folder is not in PATH, or Command Prompt was opened before PATH was updatedAdd C:\Program Files\R\R-x.y.z\bin to PATH and open a new Command Prompt
R installer does not runWindows security settings, incomplete download, or missing permissionDownload the installer again from CRAN and run it from a user account allowed to install software
Package installation failsNo internet access from R, blocked CRAN mirror, proxy issue, or no write permission to the library folderTry another CRAN mirror, check network settings, or install to a user library
RStudio opens but cannot detect RR was not installed first, or RStudio is looking at the wrong R pathInstall R first, restart RStudio, and verify the R installation path
Old and new R versions both existR upgrades usually install into a versioned folderUse the intended R version and update PATH if command-line tools still point to the older folder

FAQs about installing R on Windows

How do I install R step by step on Windows?

Download the Windows installer from the CRAN Windows base page, run the .exe file, accept the license and default setup options, complete the setup wizard, and then verify the installation with Rscript --version from a new Command Prompt window.

How do I install R on Windows 11?

On Windows 11, download the current R Windows installer from CRAN and run it like any other desktop application installer. The installation steps are the same as Windows 10 for most users. After setup, add the R bin folder to PATH only if you need to run R from the command line.

How do I install an R package in Windows?

Open R or RStudio and run install.packages("packageName"). Replace packageName with the package you want to install. For example, install.packages("jsonlite") installs the jsonlite package from CRAN.

Do I need RStudio to run R on Windows?

No. RStudio is not required to run R. You can use the R console, Command Prompt, PowerShell, or any text editor with R. RStudio is an optional IDE that makes writing scripts, viewing plots, and managing packages easier.

Where is R installed on Windows?

For a standard installation, R is usually installed in a versioned folder under C:\Program Files\R\. The command-line tools are usually inside the bin folder, such as C:\Program Files\R\R-x.y.z\bin.

QA checklist for this R on Windows installation tutorial

  • Confirm that the CRAN Windows base download link still opens the current R installer page.
  • Check that all screenshots are still useful even if the R version number shown in the image is older.
  • Verify that the PATH example uses the installed R version folder, not a copied old version number.
  • Run Rscript --version in a new Command Prompt after editing PATH.
  • Test one package installation command to confirm that R can access CRAN from the Windows machine.

R on Windows installation summary

In this R Tutorial, we have learnt a step by step process to install R on Windows machine, verify the R installation from Command Prompt, add R to the Windows PATH when needed, and install an R package after setup.