JavaScript Screen availHeight Property

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

What You’ll Learn

Screen.availHeight is a read-only instance property that returns how tall (in CSS pixels) the space available for web content is on the screen. Learn how it differs from screen.height, why taskbars and Docks matter, and how it pairs with availWidth—with five examples and try-it labs.

01

Kind

Read-only property

02

Returns

Number (CSS px)

03

Access

window.screen

04

Vs height

screen.height

05

Twin

availWidth

06

Status

Baseline widely

Introduction

Every browser window has a screen object describing the display. The full screen height is screen.height. But operating systems often keep a strip for themselves—Windows taskbar, macOS menu bar and Dock, and similar chrome.

availHeight answers: “How many CSS pixels of vertical space can web content reasonably use?” You read it as window.screen.availHeight.

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

This is about the monitor’s available area, not the current browser viewport. For the visible page height inside the tab, use window.innerHeight instead.

Understanding the Property

MDN: the read-only Screen interface’s availHeight property returns the height, in CSS pixels, of the space available for web content on the screen.

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

📝 Syntax

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

Value

A number: CSS pixels of available vertical space. It can be no larger than window.screen.height, and will be less if the device or user agent reserves vertical space for itself.

📈 height vs availHeight

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

On a Mac with the Dock at the bottom, availHeight is roughly height minus Dock and menu bar—when those stay visible. Auto-hide Dock or fullscreen mode may mean they are not subtracted.

🎨 Sizing Secondary Windows

MDN’s classic use case: open a tool palette and stretch it to the full available vertical space. The idea looks like this (popup blockers and browser policies may limit real resizing in some environments):

JavaScript
// Main window: open a small palette
const paletteWindow = window.open(
  "panels.html",
  "Panels",
  "left=0, top=0, width=200"
);

// Inside panels.html (after open), MDN-style idea:
// window.outerHeight = window.screen.availHeight;

Prefer reading availHeight for planning sizes. Assigning outerHeight is restricted in many modern browsers unless the script opened the window itself and policies allow it.

⚡ Quick Reference

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

🔍 At a Glance

Four facts about screen.availHeight.

Kind
property

Read-only

Type
number

CSS pixels

Via
window.screen

Screen object

Status
baseline

Widely available

Examples Gallery

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

📚 Getting Started

Read the available height and compare it to the full screen.

Example 1 — Read availHeight

Log the available vertical space in CSS pixels.

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

How It Works

window.screen is the Screen object. availHeight is a number you can use in layout or window-size math.

Example 2 — Compare with screen.height

Available height is never greater than the full screen height.

JavaScript
const { height, availHeight } = window.screen;

console.log(height);
console.log(availHeight);
console.log(availHeight <= height);
Try It Yourself

How It Works

When the OS reserves a strip, availHeight is smaller. When nothing is reserved (or chrome auto-hides), the two values may match.

📈 Reserved Space, Box Size & Viewport

Put the numbers to work without confusing screen vs window.

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 a visible taskbar, Dock, or menu bar. Treat it as a hint—OS reporting can vary.

Example 4 — Available Box with availWidth

Report the available rectangle for content.

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

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

How It Works

MDN pairs availHeight with availWidth for the horizontal available space. Together they describe the usable screen box.

Example 5 — Screen Available vs Window Viewport

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

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

How It Works

innerHeight / outerHeight describe this window. availHeight describes available space on the display. Resize the browser and only the window values change.

🚀 Common Use Cases

  • Planning max height for a secondary tool window or palette.
  • Logging display metrics in diagnostics or QA tools.
  • Estimating how much vertical OS chrome is reserved.
  • Teaching screen metrics vs viewport metrics to beginners.
  • Pairing with availWidth for available screen area.

🔧 How It Works

1

OS reports the display

Full size plus which chrome stays always visible.

OS
2

Browser builds Screen

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

Screen
3

You read availHeight

Gets CSS-pixel available vertical space.

Read
4

Use for sizing hints

Especially for secondary windows—not for CSS layout alone.

📝 Notes

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

Universal Browser Support

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

CSS-pixel height available for web content on the screen — often less than screen.height.

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
availHeight Excellent

Bottom line: Use screen.availHeight for available vertical display space; use innerHeight for this window’s viewport; pair with availWidth for the horizontal twin.

Conclusion

window.screen.availHeight is the available vertical space for web content in CSS pixels—often a bit less than screen.height when OS chrome is always visible. Use it for display metrics and secondary-window planning, not as a substitute for viewport height.

Continue with availWidth, Window methods, window.open(), or the JavaScript hub.

💡 Best Practices

✅ Do

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

❌ Don’t

  • Assign to availHeight (it is read-only)
  • Confuse it with window.innerHeight
  • Assume taskbars always subtract the same number of pixels
  • Rely on setting outerHeight in every browser without checks
  • Use screen metrics alone for responsive CSS (prefer media queries / container queries)

Key Takeaways

Knowledge Unlocked

Five things to remember about availHeight

Available screen height in CSS pixels.

5
Core concepts
📈 02

CSS pixels

available height

Value
03

≤ height

may subtract chrome

Rule
📐 04

Twin

availWidth

Pair
🎯 05

Baseline

widely available

Status

❓ Frequently Asked Questions

A read-only number: the height in CSS pixels of the space available for web content on the screen. Access it as window.screen.availHeight.
No. MDN marks Screen.availHeight as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
screen.height is the full screen height in CSS pixels. availHeight is never larger and is often smaller when the OS or browser reserves vertical space (taskbar, Dock, menu bar).
MDN: Dock and menu bar only reduce availHeight when they are always shown. If the Dock auto-hides, or the page is fullscreen, they may not be counted.
No. It is read-only. You read the value to size or position windows; you do not assign to it.
Use screen.availWidth for the CSS-pixel width available to the browser, the horizontal twin of availHeight.
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 screen metrics when focus follows that display.

Next: Screen.availWidth

Learn the available screen width in CSS pixels.

availWidth →

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