JavaScript Screen availWidth Property

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

What You’ll Learn

Screen.availWidth is a read-only instance property that returns how much horizontal space (in CSS pixels) is available to the window. Learn how it differs from screen.width, how it pairs with availHeight, and how it compares to innerWidth—with five examples and try-it labs.

01

Kind

Read-only property

02

Returns

Number (CSS px)

03

Access

window.screen

04

Vs width

screen.width

05

Twin

availHeight

06

Status

Baseline widely

Introduction

window.screen describes the display. Full horizontal size is screen.width. availWidth is the horizontal space available to the window—often equal to width, but sometimes smaller when the OS keeps a vertical strip (for example a taskbar docked on the left or right).

JavaScript
const screenAvailWidth = window.screen.availWidth;
console.log(screenAvailWidth);
💡
Beginner tip

This is monitor-level available width, not the width of the current tab. For the viewport inside this window, use window.innerWidth.

Understanding the Property

MDN: the Screen.availWidth property returns the amount of horizontal space (in CSS pixels) available to the window.

  • Instance — on the Screen object from window.screen.
  • Read-only — you cannot assign to availWidth.
  • CSS pixels — layout-oriented units, not always raw hardware pixels.
  • Horizontal twin — pairs with availHeight for the usable box.

📝 Syntax

JavaScript
const w = window.screen.availWidth;
// same as:
const w2 = screen.availWidth;

Value

A number: CSS pixels of horizontal space available to the window.

📈 width vs availWidth

PropertyMeaning
screen.widthFull screen width in CSS pixels
screen.availWidthHorizontal space available to the window
screen.availHeightVertical space available for web content
window.innerWidthViewport width of this window
📌
When they differ

On many desktops with only a bottom taskbar, availWidth equals width. A vertical taskbar or other side chrome can make availWidth smaller. Always compare both if you need to know reserved space.

⚡ Quick Reference

GoalCode
Available widthscreen.availWidth
Full screen widthscreen.width
Reserved horizontal pxscreen.width - screen.availWidth
Available heightscreen.availHeight
This tab’s widthwindow.innerWidth
MDN statusBaseline Widely available (Jul 2015)

🔍 At a Glance

Four facts about screen.availWidth.

Kind
property

Read-only

Type
number

CSS pixels

Via
window.screen

Screen object

Status
baseline

Widely available

Examples Gallery

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

📚 Getting Started

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

Example 1 — Read availWidth (MDN Style)

Log the available horizontal space in CSS pixels.

JavaScript
const screenAvailWidth = window.screen.availWidth;
console.log(screenAvailWidth);
console.log(typeof screen.availWidth);
Try It Yourself

How It Works

Matches MDN’s simple example: store window.screen.availWidth, then use or log the number.

Example 2 — Compare with screen.width

Available width is never greater than the full screen width.

JavaScript
const { width, availWidth } = window.screen;

console.log(width);
console.log(availWidth);
console.log(availWidth <= width);
Try It Yourself

How It Works

When nothing reserves horizontal chrome, the values match. A side taskbar can make availWidth smaller while still satisfying <= width.

📈 Reserved Space, Box Size & Viewport

Combine with height metrics and avoid viewport confusion.

Example 3 — Estimate Reserved Horizontal Space

Difference between full width and available width.

JavaScript
const reserved = screen.width - screen.availWidth;

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

How It Works

0 is common with only a bottom taskbar. A positive value often means side chrome. Treat it as a hint.

Example 4 — Available Box with availHeight

Report the usable screen rectangle.

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

availWidth × availHeight describes the available screen area. See also availHeight.

Example 5 — Screen Available vs Window Viewport

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

JavaScript
console.log({
  availWidth: screen.availWidth,
  screenWidth: screen.width,
  innerWidth: window.innerWidth,
  outerWidth: window.outerWidth
});
Try It Yourself

How It Works

Resize the browser: innerWidth / outerWidth change. availWidth stays tied to the display’s available width.

🚀 Common Use Cases

  • Planning max width for secondary windows or tool palettes.
  • Logging display metrics in diagnostics or QA tools.
  • Estimating horizontal OS chrome with width - availWidth.
  • Building an available screen box with availHeight.
  • Teaching screen metrics vs viewport metrics.

🔧 How It Works

1

OS reports the display

Full width plus any always-visible side chrome.

OS
2

Browser builds Screen

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

Screen
3

You read availWidth

Gets CSS-pixel horizontal space available to the window.

Read
4

Use for sizing hints

Pair with availHeight; use innerWidth 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 availWidth.
  • Not the same as window.innerWidth (viewport of this window).
  • Related: availHeight, Window hub, window.open(), JavaScript hub.

Universal Browser Support

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

CSS-pixel horizontal space available to the window — often equal to screen.width.

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

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

Conclusion

window.screen.availWidth is the horizontal space available to the window in CSS pixels. Compare it with screen.width, pair it with availHeight, and use innerWidth when you mean this tab’s viewport.

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

💡 Best Practices

✅ Do

  • Read screen.availWidth for available display width
  • Compare with screen.width to detect side chrome
  • Pair with availHeight for the usable screen box
  • Use innerWidth for layout inside the current tab
  • Expect values to vary by OS and taskbar position

❌ Don’t

  • Assign to availWidth (it is read-only)
  • Confuse it with window.innerWidth
  • Assume it always differs from screen.width
  • Use screen metrics alone for responsive CSS
  • Forget multi-monitor moves can change reported screen values

Key Takeaways

Knowledge Unlocked

Five things to remember about availWidth

Available screen width in CSS pixels.

5
Core concepts
📐 02

CSS pixels

available width

Value
03

≤ width

may subtract chrome

Rule
📈 04

Twin

availHeight

Pair
🎯 05

Baseline

widely available

Status

❓ Frequently Asked Questions

A number: the amount of horizontal space in CSS pixels available to the window. Access it as window.screen.availWidth.
No. MDN marks Screen.availWidth as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
screen.width is the full screen width in CSS pixels. availWidth is the horizontal space available to the window and is often the same, but can be smaller if the OS reserves horizontal chrome (for example a vertical taskbar).
They are twins: availWidth is horizontal available space; availHeight is vertical available space. Together they describe the usable screen box for web content.
No. It is read-only. You read the value for sizing or diagnostics; you do not assign to it.
No. availWidth is about the display’s available horizontal space. innerWidth is the layout viewport width of this browser window/tab.
Did you know?

MDN documents availWidth briefly as “horizontal space available to the window,” while availHeight spells out reserved Dock/taskbar cases more. In practice, treat both as the available screen box—and always verify on the OS you care about.

Next: Screen.colorDepth

Learn the screen color depth property (often reported as 24).

colorDepth →

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