How to Close All Open Tabs on iPhone?
Safari on iPhone and iPad allows users to open as many tabs as needed. However, opening too many tabs can slow things down and make searching difficult.
Instead of closing each tab individually, you can quickly shut them all using a built-in feature.
Below, you will find methods to close all tabs manually and through automation testing.

Manually Closing All Tabs on Safari
If you have multiple tabs open and want to clear them at once, follow these steps:
- Open the Safari browser on your iPhone or iPad.
- Tap the Tabs button at the bottom-right corner (it looks like two overlapping squares).
- Press and hold the Done button at the bottom right.
- A menu will appear with different options.
- Select Close All Tabs to remove all open tabs instantly.
- Confirm your choice if prompted.
This method is quick and effective when starting fresh without manually closing each tab.

Alternative Method to Close All Tabs
Some users may prefer an alternative way to achieve the same result:
- Open Safari and press the Tabs button.
- Instead of long-pressing the Done button, scroll through open tabs.
- Swipe each tab to the left to close them manually.
- If there are too many tabs, long-pressing Done remains the fastest method.
While swiping to close tabs works, it is time-consuming compared to the shortcut.
Automating Tab Closure in iOS Safari
For users performing automated testing, the process can be streamlined using Appium. Below is a Java code snippet for closing all Safari tabs in iOS 11 and later.
Important Considerations
- This method does not work with iOS 10 or earlier versions.
- Android devices are not compatible with this approach.
- Automation is helpful for developers and testers who must perform this task repeatedly.

Java Code for Automating Safari Tab Closure
Map<String, Object> params = new HashMap<>();
params.clear();
params.put(“automation”, “os”);
driver.executeScript(“mobile:browser:open”, params);
driver.context(“NATIVE_APP”);
WebElement browserTab = driver.findElementByXPath(“//*[@label=\”Tabs\”]”);
TouchAction action = new TouchAction(driver);
action.longPress(browserTab).press(browserTab);
action.perform();
action.longPress(browserTab).release();
action.perform();
params.clear();
params.put(“content”, “Close All”);
params.put(“timeout”, “30”);
driver.executeScript(“mobile:text:find”, params);
driver.context(“NATIVE_APP”);
driver.findElementByXPath(“//XCUIElementTypeButton[contains(@label,'Close All')]”).click();
Thread.sleep(10000);
Breaking Down the Java Code
The provided Java code works by:
- Opening Safari through automation.
- Switching to the NATIVE_APP context.
- Identifying the Tabs button in Safari.
- Performing a long-press action on the Tabs button.
- Searching for the “Close All” option.
- Click the “Close All” button to remove all tabs.
- Introducing a short wait time to ensure execution is completed.
This method is beneficial in test automation, ensuring consistent behavior across multiple test cases.
Comparison of Manual and Automated Methods
The table below highlights the key differences between manual and automated tab closure:
Method | Requirements | Compatibility | Best For |
Manual | iPhone or iPad with Safari | iOS 10 and later | Regular users |
Automation | Appium setup, Java environment | iOS 11 and later | Test automation |
Why Close Tabs Regularly?
Keeping too many tabs open in Safari can:
- Reduce browser performance.
- Drain the battery faster.
- Make it more challenging to find important pages.
Regularly clearing tabs ensures better browsing speed and organization.
Conclusion
Closing all tabs in Safari can be done manually or through automation. Manual closure is quick for everyday use, while automation benefits developers and testers.
Regardless of the method, keeping your tabs organized improves your browsing experience.

Jim's passion for Apple products ignited in 2007 when Steve Jobs introduced the first iPhone. This was a canon event in his life. Noticing a lack of iPad-focused content that is easy to understand even for “tech-noob”, he decided to create Tabletmonkeys in 2011.
Jim continues to share his expertise and passion for tablets, helping his audience as much as he can with his motto “One Swipe at a Time!”