The Excel CODE function is a Text formula that converts a specified character into the corresponding code based on the character set used by your computer. This can be useful for when you want to find out the code for a specific character, or using this value in other formulas. In this guide, we’re going to show you how to use Excel CODE function and also throw in some tips and error handling methods.

Supported versions

  • All Excel versions

Excel CODE Function Syntax




The text for which you want the code of the first character.



Begin by entering the target text for the value argument. Let's take a look at how this works on an example.

formula returns 65.

Multi-character string

If the text argument contains more than one characters, like a word or a sentence, the CODE function converts only the first character of the target string.

Both functions below will return the same result.



Download Workbook