gives a list of the integer codes corresponding to the characters in a string.


gives integer codes according to the specified encoding.


  • ToCharacterCode handles both ordinary and special characters.
  • ToCharacterCode["string"] and ToCharacterCode["string","Unicode"] return standard internal character codes used by the Wolfram Language, which are the same on all computer systems.
  • For characters on an ordinary American English keyboard, the character codes follow the ASCII standard.
  • For common European languages, they follow the ISO Latin1 standard.
  • For other characters, they follow the Unicode standard.
  • The Wolfram System defines various additional characters in private Unicode space, with character codes between 57344 and 63743.
  • Character codes returned by ToCharacterCode["string"] lie between 0 and 1114111.
  • Encodings supported in ToCharacterCode["string","encoding"] include the values in $CharacterEncodings in addition to "Unicode".
  • If a particular character has no character code in a given encoding, ToCharacterCode returns None in place of a character code.
  • ToCharacterCode[{"s1","s2",}] gives a list of the lists of integer codes for each of the si.


open allclose all

Basic Examples  (2)

Find ASCII or Unicode character codes:

Reassemble a string from character codes:

Get the byte values corresponding to the UTF8 encoding of a string:

Reassemble the string from its UTF8 encoding:

Scope  (3)

Find the code points of several strings:

Use a character encoding:

Get the codes of all printable ASCII characters:

Some ISO Latin-1 letters:

Some characters in the private use area:

Some emojis:

Properties & Relations  (6)

ToCharacterCode always returns a list:

The default encoding is "Unicode":

If a particular character code does not exist in the specified encoding, None is returned for it:

FromCharacterCode is the inverse of ToCharacterCode:

This is also true for lists of strings:

The allowed values of the second argument are given by $CharacterEncodings:

Some characters are composed of multiple codes:

Neat Examples  (1)

"Plot" a string:

Wolfram Research (1991), ToCharacterCode, Wolfram Language function, (updated 2019).


Wolfram Research (1991), ToCharacterCode, Wolfram Language function, (updated 2019).


Wolfram Language. 1991. "ToCharacterCode." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019.


Wolfram Language. (1991). ToCharacterCode. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_tocharactercode, author="Wolfram Research", title="{ToCharacterCode}", year="2019", howpublished="\url{}", note=[Accessed: 24-June-2024 ]}


@online{reference.wolfram_2024_tocharactercode, organization={Wolfram Research}, title={ToCharacterCode}, year={2019}, url={}, note=[Accessed: 24-June-2024 ]}