Skip to tool

JavaScript String.charCodeAt() Online

Read the first UTF-16 code unit with JavaScript charCodeAt().

The output updates as you type. The tool processes input in your browser.

Worked example

Use a non-ASCII character to see why the byte, UTF-16 code unit, and Unicode code point can differ.

Sample input
😀
Sample output
55357

JavaScript example

console.log("😀".charCodeAt(0));
Expected native output
55357

Using this operation in JavaScript

The interactive result uses JavaScript. JavaScript string indexes count UTF-16 code units. Use code-point iteration when working with supplementary Unicode characters.

JavaScript reference