If you use R or RStudio regularly, you know how quickly the console can fill up with lines of output, warnings, or debugging messages. Over time, that clutter can make it harder to focus on your current work or see recent results clearly.
Whether you’re running statistical analysis, plotting graphs, or debugging functions, a clean console can help you stay organized and focused. Fortunately, clearing the console in R and RStudio on Windows is quick and easy — once you know the right commands and shortcuts.
In this guide, we’ll walk you through how to clear the console in both R and RStudio on Windows, along with a few pro tips to make your workflow smoother.
What Is the R Console?
The R console is the interactive area where your commands are executed and results appear. It’s where you type R code, press Enter, and view the output in real time.
In RStudio, the console appears in the bottom-left panel by default, while in base R (the R GUI), it’s the main window you interact with.
After running multiple commands, your console might look something like this:
> x <- 1:10
> mean(x)
[1] 5.5
> summary(x)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.00 3.25 5.50 5.50 7.75 10.00
If you want to clear everything and start fresh — without closing your session — here’s how to do it.
Method 1: Clear Console in RStudio (Windows)
RStudio provides a built-in shortcut and function for clearing the console.
Option 1: Use Keyboard Shortcut
The fastest way is to use this simple keyboard command:
Press:
Ctrl + L
This immediately clears all visible text from the RStudio console window, leaving you with a clean workspace.
Tip: This doesn’t delete variables or data from your environment — it only clears what you see in the console.
Option 2: Use the RStudio “Edit” Menu
If you prefer using the mouse:
- Click on the Edit menu in the top toolbar.
- Select Clear Console.
- The console will instantly clear.
This is especially useful if you’re new to RStudio or prefer menu navigation over keyboard shortcuts.
Option 3: Run a Console Command
You can also clear the RStudio console using an R command:
cat("\014")
This command sends a special form-feed character to RStudio’s console, telling it to refresh (essentially clearing the screen).
You can even assign it to a custom function for convenience:
clear_console <- function() cat("\014")
Then just run:
clear_console()
whenever you need a clean console.
Method 2: Clear Console in Base R (R GUI)
If you’re using the standard R environment (not RStudio), the process is slightly different.
Option 1: Use Keyboard Shortcut
Unfortunately, Ctrl + L doesn’t work in the default R GUI on Windows.
Instead, you can use this command inside R:
cat("\014")
It works just like in RStudio — it sends a clear-screen signal to the console, refreshing it.
Option 2: Use the “Misc” Menu
In base R GUI, there’s also a manual way:
- Click on the Misc menu at the top.
- Choose Clear Console.
This will remove everything currently displayed in your console.
Method 3: Clear Workspace and Console Together
If you not only want to clear the console but also remove all objects (variables, functions, data frames, etc.) from your environment, you can do both in one go:
rm(list = ls())
cat("\014")
rm(list = ls())removes all objects from your R environment.cat("\014")clears the console display.
After running these two commands, your session will be completely clean — like you just restarted R.
Caution: This deletes all unsaved variables permanently. Use with care.
Method 4: Automate Console Clearing on Startup
If you prefer to always start with a clean console when opening R or RStudio, you can automate the process.
For RStudio:
- Go to Tools → Global Options → Code → Saving.
- Uncheck “Restore .RData into workspace at startup.”
- Also uncheck “Always save history (or workspace) on exit.”
This ensures that every new session opens with a blank console and a clean environment.
For Base R:
You can create or edit a .Rprofile file in your R home directory and add this line:
cat("\014")
Now, your console will clear automatically each time R starts.
Wrapping Up
And that’s it — you now know how to clear the console in R and RStudio on Windows using multiple methods.
Whether you prefer shortcuts like Ctrl + L, direct commands like cat("\014"), or menu options, R makes it easy to reset your workspace whenever things get cluttered.
For everyday use, Ctrl + L in RStudio is the quickest and most efficient way to keep your console clean. If you want a completely fresh start, combine it with:
rm(list = ls())
cat("\014")
and you’ll have a spotless environment every time.