Favorites

DOM HTMLElement.innerText Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
HTMLElement.innerText
DOM HTMLElement PropertyThis property is supported by all modern browsers.
Updated 28th November 2026

The innerText property gets the text of an element as it appears on screen, respecting CSS, or replaces its content with text.

Description

The innerText property returns the rendered text of an element: what a user would get by selecting and copying it. Unlike textContent, it leaves out hidden elements, follows CSS such as text-transform, and turns block elements and <br> into line breaks. Because it depends on CSS, reading it triggers a layout calculation, so it's slower.

Setting it replaces the element's content with text, converting line breaks into <br> elements.

Because reading innerText can force the browser to recalculate layout, avoid reading it in tight loops. Use it when you specifically need the text as the user sees it, such as copying visible text to the clipboard, and textContent otherwise.

Syntax

element.innerText
element.innerText = text

Value

A string of the element's rendered text, as it appears on screen.

Example

<div id="el"><p style="text-transform:uppercase">shout</p><p>Line two</p><span hidden>secret</span></div>
const el = document.getElementById('el');
console.log(JSON.stringify(el.innerText));
console.log(JSON.stringify(el.textContent));

Browser Support

The following information will show you the current browser support for the HTMLElement.innerText property. Hover over a browser icon to see the version that first introduced support for this property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee