The ord() Command


Command Summary

Gives the ASCII code of a character.

Command Syntax


Menu Location

  • Press 2nd MATH to enter the MATH popup menu.
  • Press D to enter the string submenu.
  • Press B to select ord(.

Calculator Compatibility

This command works on all calculators.

Token Size

2 bytes

The ord() command gives the ASCII code of a character (that is, its character code, which is a modification of standard ASCII). The input is meant to be a single character, but the command doesn't actually check for that — so in practice, it gives the ASCII code of the first character in a string. You can convert multiple characters at once by giving ord() a list (or matrix) of characters.

The inverse of ord() is char(), which converts a character code to a character.

           {65  98  99}


Code such as


should be replaced by appropriate use of ord(); in this case,

Related Commands

See Also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.