JavaScript Screen availWidth Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

screen.availWidth is a read-only number: the amount of horizontal space, in CSS pixels, available to the window (MDN). Read it as window.screen.availWidth.

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use screen.availWidth. Start with this line.

JavaScript
window.screen.availWidth
CallWhat it does
window.screen.availWidthPrimary signature.

Built into the browser. Read screen.availWidth on window.screen — no import required.

Library declarations
JavaScript
window.screen.availWidth

Parameters

This member has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*Number (CSS pixels)

JavaScript Examples

Example 1 — Read availWidth

Log the available screen width in CSS pixels.

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

How It Works

  1. Access window.screen. Every window exposes a Screen object.
  2. Read availWidth. MDN: horizontal space available to the window (CSS px).
  3. Check typeof. It is always a number in browsers that support Screen.
  4. Do not write to it. The property is read-only.

Example 2 — vs width

Compare available width with full screen width and estimate reserved space.

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

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

How It Works

  1. Read both widths. Full vs available (MDN).
  2. Subtract. The difference approximates side chrome (e.g. a vertical taskbar).
  3. Assert avail <= width. Available space cannot exceed the full screen.
  4. Expect zero often. Many desktops reserve no horizontal chrome.

Example 3 — with availHeight

Report the available screen box MDN pairs with availWidth.

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

  1. Read availWidth. Horizontal available space (MDN).
  2. Read availHeight. Vertical twin.
  3. Print a box. Useful when opening or sizing a tool window.
  4. Optional area. Width × height is a quick size check, not a layout API.

Browser Support

Screen.availWidth is Baseline Widely available across modern browsers (MDN: since July 2015).

✓ Baseline · Widely available

Screen.availWidth

Supported in Chrome, Firefox, Safari, Edge, and Opera. Read-only CSS-pixel available width via window.screen.

Baseline Widely available
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
screen.availWidth Excellent in browsers

Bottom line: Safe to read in modern browsers. See the MDN Screen.availWidth reference.

Frequently Asked Questions

A read-only number: the amount of horizontal space in CSS pixels available to the window. Access it as window.screen.availWidth (MDN).
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 never larger 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.

Next: Screen colorDepth

Learn how many bits the screen uses for color.

colorDepth tutorial →

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.

14 people found this page helpful