MouseEvent.pageY is a read-only number: the mouse’s vertical position relative to the entire document, including scrolled-away content. Learn how it differs from clientY and offsetY, the scroll formula, and five try-it labs.
01
Kind
Instance property
02
Returns
Number (CSS px)
03
Status
Baseline Widely available
04
Origin
Document top edge
05
Pair with
pageX
06
Scroll
Included in the value
Fundamentals
Introduction
Absolute pins on a tall article, annotations down a long page, and document-space hit maps need “how far from the top of the page?” That is pageY (vertical), paired with pageX (horizontal)—coordinates relative to the whole document.
JavaScript
document.addEventListener("mousemove", (event) => {
console.log(event.pageY); // pixels from document top (includes scroll)
});
💡
Beginner tip
Same idea as pageX: if 200px of the top is scrolled away and you click 100px from the viewport’s top edge, pageY is about 300.
Concept
Understanding the Property
MDN: pageY returns the Y (vertical) coordinate (in pixels) at which the mouse was clicked, relative to the top edge of the entire document. This includes any portion of the document not currently visible. MDN also points to pageX for the fuller coordinate-system explanation.
Instance — read event.pageY in a handler.
Number — CSS pixels; a floating-point double.
Document-relative — includes vertical scroll.
Read-only — set via constructor options on synthetic events only.
Foundation
📝 Syntax
JavaScript
const y = mouseEvent.pageY;
Value
A double floating-point value in pixels (MDN) from the top edge of the document, regardless of scrolling or viewport positioning.
MouseEvent.pageY is Baseline Widely available across modern browsers (MDN: since July 2015). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline · Widely available
MouseEvent.pageY
Reliable document-relative Y including vertical scroll—great for absolute page markers.
UniversalWidely available
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support · Desktop & Mobile
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerSupported in modern IE versions
Full support
pageYExcellent
Bottom line: Read event.pageY for document-space vertical position; pair with pageX for a full document point.
Wrap Up
Conclusion
event.pageY gives you the vertical mouse position relative to the entire document, including scrolled content. Use it for absolute page markers; reach for clientY for viewport UI and offsetY for element-local clicks.
Use absolute positioning when placing page markers
Prefer clientY for position: fixed UI
❌ Don’t
Confuse pageY with viewport clientY
Ignore vertical scroll when debugging large pageY values
Use page coordinates for fixed tooltips without converting
Assume it equals offsetY inside an element
Mutate event.pageY on live user events
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about pageY
Document-relative Y that includes vertical scroll.
5
Core concepts
🖱️01
Instance
on the event
Kind
🔢02
Double
CSS pixels
Type
📄03
Document
top edge origin
Origin
📈04
Scroll-aware
+ scrollY
Math
🛡️05
Baseline
widely available
Status
❓ Frequently Asked Questions
It is a read-only number: the vertical mouse position in CSS pixels relative to the top edge of the entire document, including any part of the page that is scrolled out of view.
No. MDN marks MouseEvent.pageY as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard, so no status warning banner is needed.
pageY includes vertical scroll. If 200px of the top is scrolled away and you click 100px from the viewport’s top edge, pageY is about 300—the same idea as pageX for the horizontal axis.
clientY is relative to the viewport (window) and ignores document scroll. pageY is relative to the document and grows when you scroll down. Often: pageY ≈ clientY + window.scrollY.
offsetY is relative to the target element’s top padding edge. pageY is relative to the whole document. Use offsetY for clicks inside a box; use pageY for markers on a tall scrolled page.
A double floating-point value in pixels (MDN). Pair it with pageX for a full document point.
Did you know?
MDN’s pageY page is short on purpose: it points you to pageX for the deeper coordinate-system story. Vertically, the same scroll-aware rule applies—pageY always measures from the document top, not the window top.