window.scrollBy() scrolls the document by the given amount from the current position (MDN). Pass (x, y) deltas or an options object with top, left, and behavior. For absolute coordinates, use scrollTo().
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call window.scrollBy. Start with this line.
JavaScript
scrollBy(x, y) or scrollBy(options)
Call
What it does
scrollBy(x, y) or scrollBy(options)
Primary signature.
window.scrollBy(...)
Call with the arguments your case needs.
Built into the browser. Call window.scrollBy(...) (or the global scrollBy(...)) — no import required.
Library declarations
JavaScript
scrollBy(x, y) or scrollBy(options)
Parameters
Parameter
Description
options.behavior
Optional. smooth, instant, or auto
Negative values
Optional. Scroll up / left
Return Value
Return Value
Description
*
Promise<{ interrupted }> (support varies)
JavaScript Examples
Example 1 — Scroll by a Delta
MDN: scroll the document by a given amount from the current position.
Compare. New scrollY should be about +100 (unless clamped).
Smooth note. With behavior: "smooth", read again after animation if needed.
Compatibility
Browser Support
Window.scrollBy() is marked Baseline Widely available on MDN (since July 2015). It is not Deprecated, Experimental, or Non-standard. Promise return / interrupted may vary — feature-detect if you depend on it. Browser Window API — not a Node.js built-in.
✓ Baseline · Widely available
scrollBy()
Scroll the document by a relative delta across modern browsers.
99%Core tag support
ChromeYes
Full support
EdgeYes
Full support
FirefoxYes
Full support
SafariYes
Full support
OperaYes
Full support
HTML element100% supported
Bottom line: Safe for modern apps. Prefer options + behavior for smooth UX; detect Promise support before awaiting.
Frequently Asked Questions
It scrolls the document by a relative amount from the current position (MDN). Positive y scrolls down; negative y scrolls up. Positive x scrolls right; negative x scrolls left.
No. MDN marks Window.scrollBy() as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard. Some parts (such as the Promise return) may vary by browser.
MDN documents a Promise that fulfills with { interrupted }. interrupted is true if another programmatic scroll started on the window before the first finished. Feature-detect if you rely on the Promise.
scrollBy() adds a delta to where you are now. scrollTo() jumps to absolute document coordinates. Use scrollBy for “next step” controls; use scrollTo or scrollIntoView for a known target.
Optional string: smooth (animate), instant (jump), or auto (use the computed CSS scroll-behavior). Default is auto (MDN).
Yes. Use window.scrollBy(0, window.innerHeight) or scrollBy({ top: window.innerHeight, behavior: "smooth" }) for a full-screen step.