JavaScript Screen height Property

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline Widely available
Instance property

What You’ll Learn

Screen.height is a read-only instance property that returns the full height of the screen in CSS pixels. Learn how it differs from availHeight and innerHeight, how OS chrome shrinks available space, and the classic MDN comparison—with five examples and try-it labs.

01

Kind

Read-only property

02

Returns

Number (CSS px)

03

Access

window.screen

04

Meaning

Full screen height

05

Twin

screen.width

06

Status

Baseline widely

Introduction

The browser’s screen object describes the display behind your window. screen.height answers: “How tall is the whole screen, in CSS pixels?” That is the full vertical size of the monitor (or the display associated with this window)—not how tall the current tab is.

Operating systems often keep a strip for themselves (taskbar, Dock, menu bar). That is why availHeight can be smaller than height. MDN’s classic check is: if they differ, something is occupying screen real estate.

JavaScript
console.log(window.screen.height);
💡
Beginner tip

screen.height is about the monitor. For the visible page height inside the tab, use window.innerHeight instead.

Understanding the Property

MDN: the Screen.height read-only property returns the height of the screen in CSS pixels.

  • Instance — on the Screen object from window.screen.
  • Read-only — you cannot assign to height.
  • CSS pixels — same unit family as layout sizes (not always hardware pixels).
  • Full height — may be larger than availHeight when OS chrome is reserved.

📝 Syntax

JavaScript
const h = window.screen.height;
// same as:
const h2 = screen.height;

Value

A number: the full screen height in CSS pixels. Compare it with window.screen.availHeight when you care about space left after OS chrome.

📈 height vs availHeight

PropertyMeaning
screen.heightFull screen height in CSS pixels
screen.availHeightHeight available for web content (often minus OS chrome)
screen.widthFull screen width (horizontal twin)
window.innerHeightViewport / layout viewport height of this window
📌
MDN note

Not all of the height from screen.height may be available to the window. Widgets such as taskbars or OS-integrated toolbars can reduce space. That difference shows up as height vs availHeight.

🎨 Detect Occupied Screen Space

MDN’s teaching example: if available height differs from full height, something is occupying screen real estate.

JavaScript
if (window.screen.availHeight !== window.screen.height) {
  // Something is occupying some screen real estate!
  console.log("OS chrome likely reserved vertical space");
} else {
  console.log("Full height appears available");
}

Auto-hide taskbars/Docks or fullscreen mode may make the two values match even when chrome can appear later.

⚡ Quick Reference

GoalCode
Full screen heightscreen.height
Available heightscreen.availHeight
Reserved vertical pxscreen.height - screen.availHeight
MDN occupied checkavailHeight !== height
This tab’s heightwindow.innerHeight
MDN statusBaseline Widely available (Jul 2015)

🔍 At a Glance

Four facts about screen.height.

Kind
property

Read-only

Type
number

CSS pixels

Via
window.screen

Screen object

Status
baseline

Widely available

Examples Gallery

Examples follow MDN Screen.height. Numbers on your machine will differ by display and OS chrome.

📚 Getting Started

Read the full height and practice the MDN occupied-space check.

Example 1 — Read height

Log the full screen height in CSS pixels.

JavaScript
console.log(window.screen.height);
console.log(typeof screen.height);
Try It Yourself

How It Works

window.screen is the Screen object. height is a number you can compare with available or viewport heights.

Example 2 — MDN Occupied-Space Check

Compare full height with available height.

JavaScript
if (window.screen.availHeight !== window.screen.height) {
  console.log("Something is occupying some screen real estate!");
} else {
  console.log("Full height appears available");
}
Try It Yourself

How It Works

Directly inspired by MDN. When a taskbar or Dock is always shown, availHeight is usually smaller.

📈 Reserved Space, Full Box & Viewport

Put the full height next to related size metrics.

Example 3 — Estimate Reserved Vertical Space

Difference between full height and available height.

JavaScript
const reserved = screen.height - screen.availHeight;

console.log("full:", screen.height);
console.log("avail:", screen.availHeight);
console.log("reserved:", reserved);
Try It Yourself

How It Works

A positive reserved often means visible OS chrome. Treat it as a hint—OS reporting can vary by Dock auto-hide and fullscreen.

Example 4 — Full Screen Box with width

Report the full screen rectangle.

JavaScript
const box = {
  width: screen.width,
  height: screen.height
};

console.log(box.width + " x " + box.height);
console.log(box.width * box.height);
Try It Yourself

How It Works

width and height describe the full display size. Pair with availHeight / availWidth for the usable box.

Example 5 — Screen Height vs Window Viewport

Do not mix up monitor height with this tab’s viewport.

JavaScript
console.log({
  screenHeight: screen.height,
  availHeight: screen.availHeight,
  innerHeight: window.innerHeight,
  outerHeight: window.outerHeight
});
Try It Yourself

How It Works

innerHeight / outerHeight describe this window. screen.height describes the display. Resize the browser and only the window values change.

🚀 Common Use Cases

  • Logging full display resolution for diagnostics or QA.
  • Detecting whether OS chrome reserves vertical space (MDN check).
  • Teaching screen metrics vs viewport metrics to beginners.
  • Pairing with screen.width for full screen size.
  • Comparing with availHeight before sizing secondary windows.

🔧 How It Works

1

OS knows the display size

Full resolution plus which chrome stays always visible.

OS
2

Browser builds Screen

Exposes height, availHeight, width, availWidth, and more.

Screen
3

You read height

Gets full CSS-pixel vertical size of the screen.

Read
4

Compare with avail / viewport

Use availHeight for usable space; innerHeight for this tab.

📝 Notes

  • Baseline Widely available (MDN, since July 2015).
  • Not Deprecated, Experimental, or Non-standard — no status banner required.
  • Read-only — do not assign to height.
  • Not the same as window.innerHeight (viewport of this window).
  • Related: colorDepth, availHeight, Window hub, JavaScript hub.

Universal Browser Support

Screen.height 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

Screen.height

Full screen height in CSS pixels — often larger than availHeight when OS chrome is reserved.

Universal Widely available
Google Chrome Full support · Desktop & Mobile
Full support
Mozilla Firefox Full support · Desktop & Mobile
Full support
Apple Safari Full support · macOS & iOS
Full support
Microsoft Edge Full support · Chromium
Full support
Opera Full support · Modern versions
Full support
Internet Explorer Supported in modern IE versions
Supported
height Excellent

Bottom line: Use screen.height for full display height; use availHeight for available vertical space; use innerHeight for this window’s viewport.

Conclusion

window.screen.height is the full vertical size of the screen in CSS pixels—often a bit more than availHeight when OS chrome is always visible. Use it for display metrics and comparisons, not as a substitute for viewport height.

Continue with isExtended, availHeight, Window methods, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Read screen.height for full display height
  • Compare with availHeight to see reserved chrome
  • Pair with screen.width for full screen size
  • Use innerHeight for layout inside the current tab
  • Expect values to differ by OS, Dock settings, and fullscreen

❌ Don’t

  • Assign to height (it is read-only)
  • Confuse it with window.innerHeight
  • Assume taskbars always subtract the same number of pixels
  • Use full screen height alone for responsive CSS layout
  • Ignore availHeight when planning secondary window sizes

Key Takeaways

Knowledge Unlocked

Five things to remember about height

Full screen height in CSS pixels.

5
Core concepts
📈 02

CSS pixels

full screen height

Value
03

≥ availHeight

may include chrome

Rule
📐 04

Twin

screen.width

Pair
🎯 05

Baseline

widely available

Status

❓ Frequently Asked Questions

A read-only number: the full height of the screen in CSS pixels. Access it as window.screen.height.
No. MDN marks Screen.height as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
screen.height is the full screen height. availHeight is the space available for web content and is never larger—often smaller when a taskbar, Dock, or menu bar stays visible.
No. height is the monitor’s full height. innerHeight is this browser window’s viewport height and changes when you resize the tab.
No. It is read-only. You read the value; you do not assign to it.
Use screen.width for the full screen width in CSS pixels, the horizontal twin of height.
Did you know?

Multi-monitor setups still expose a single window.screen for the display associated with the window. Moving a window to another monitor can change the reported height when that display has a different resolution.

Next: Screen.isExtended

Learn the experimental multi-monitor boolean on Screen.

isExtended →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful