Window innerWidth property

Definition and Usage

innerWidth The property returns the width of the window content area.

innerWidth The property is read-only.

See also:

innerHeight property

outerWith property

outerHeight property

Instance

Example 1

Get the window width:

let width = window.innerWidth;

Try it yourself

let width = innerWidth;

Try it yourself

Example 2

All height and width properties:

let text =
"<p>innerWidth: " + window.innerWidth + "</p>" +
"<p>innerHeight: " + window.innerHeight + "</p>" +
"<p>outerWidth: " + window.outerWidth + "</p>" +
"<p>outerHeight: " + window.outerHeight + "</p>";

Try it yourself

Syntax

window.innerWidth

Or:

innerWidth

Return value

Type Description
Number The internal width of the browser window content area (in pixels).

Browser Support

All Browsers Support window.innerWidth:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support