JavaScript (ES2026) reference · String Methods

JavaScript String.fromCharCode() Method

Create a string from UTF-16 code units, for example String.fromCharCode(72, 105) gives "Hi".

JavaScript (ES2026) Since ES1

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

String.fromCharCode(code1, code2, /* …, */ codeN)

Parameters

ParameterDescription
codes Numbers between 0 and 65535.

Return value

A string.

Examples

Codes to textTry it yourself
console.log(String.fromCharCode(72, 105));

Output

Hi
Generate the alphabetTry it yourself
const letters = Array.from({ length: 5 }, (_, i) => String.fromCharCode(65 + i));
console.log(letters.join(""));

Output

ABCDE

Version history

VersionChange
JavaScript ES1Added

In other languages

Was this page helpful?