Viewports
Configure viewport sizes for your sessions
Overview
A viewport defines the visible area of a web page in a browser window. While setting a custom viewport is optional in Browserbase, it can be helpful for specific use cases — such as visual testing, screenshot generation, or automations that rely on precise layout behavior.
By default, Browserbase generates realistic, randomized viewports to enhance stealth and reduce detection. However, if your automation requires a consistent viewport size (e.g., for comparing screenshots across sessions), you can select from a predefined set of supported dimensions.
Supported Viewport Sizes
When creating a session, you can choose from the following approved viewport dimensions. These values are optimized for reliability and stealth, and are the only sizes currently supported.
Desktop Viewports
Width | Height | Device |
---|---|---|
1920 | 1080 | Standard Full HD (Desktop) |
1366 | 768 | Widescreen Laptop |
1536 | 864 | High-Resolution Laptop |
1280 | 720 | Small Desktop Monitor |
1024 | 768 | Minimum Supported Desktop Viewport |
Mobile Viewports
Width | Height | Device |
---|---|---|
414 | 896 | iPhone XR, iPhone 11 |
390 | 844 | iPhone 12, iPhone 13, iPhone 14 |
375 | 812 | iPhone X, iPhone XS |
360 | 800 | Standard Android Phone |
320 | 568 | iPhone SE, Small Devices |
Only the viewports listed above are supported. Custom dimensions outside these values are not allowed to ensure consistent performance, rendering accuracy, and anti-bot stealth effectiveness.
How to Set a Viewport in Your Session
Use the viewport
and fingerprint.screen
fields when creating a session to specify the desired width and height. Below are examples in both Node.js and Python SDKs.
Custom viewports are a powerful feature when precision matters — whether you’re automating mobile interactions, capturing consistent screenshots, or testing responsive layouts. For most use cases, Browserbase’s default viewport generation provides the best balance of stealth and reliability. Only configure a specific viewport if your use case requires it.
For a full list of session options and configuration fields, check out the API reference for creating a session.