Skip to tool

Python len() Online

Count Unicode code points, as Python len() does for a string.

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

Worked example

A visual character can contain multiple Unicode code points. Compare the text length and UTF-8 byte count when validating a storage limit.

Sample input
A😀
Sample output
2

Python example

print(len("A😀"))
Expected native output
2

Using this operation in Python

The interactive result uses JavaScript. Python str stores Unicode text. Encode to bytes when an API expects UTF-8 or another byte representation.

Python reference