C# Char ConvertToUtf32() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Char

Definition

In C#, Char.ConvertToUtf32 returns an int Unicode code point. Overloads accept a single BMP char, a high/low pair, or a string index at the start of a character.

For emoji and other non-BMP symbols, pass the pair (or string index) so both surrogates are included.

This is a static member of System.Char. You call it with the type name, such as Char.ConvertToUtf32(...) or char.ConvertToUtf32(...). A char holds one 16-bit UTF-16 code unit.

Syntax

Pass a BMP char, a pair, or a string index.

C#
int cp1 = Char.ConvertToUtf32('A');
int cp2 = Char.ConvertToUtf32(emoji, 0);
CallWhat it does
Char.ConvertToUtf32('A')Returns 0x41.
Char.ConvertToUtf32(high, low)Code point from a pair.
Char.ConvertToUtf32(s, i)Code point starting at i.

Throws if a string index points at an incomplete or invalid pair.

Library declarations
C#
public static int ConvertToUtf32(char c);
public static int ConvertToUtf32(char highSurrogate, char lowSurrogate);
public static int ConvertToUtf32(string s, int index);

Parameters

ParameterDescription
cBMP character.
highSurrogate, lowSurrogateValid pair.
s, indexString and start index.

Return Value

Return ValueDescription
intUnicode scalar value (code point).

C# Examples

Example 1 — Letter to Code Point

Convert A to its code point.

C#
using System;

class Program {
    static void Main() {
        int cp = Char.ConvertToUtf32('A');
        Console.WriteLine(cp);
        Console.WriteLine(cp.ToString("X"));
    }
}

How It Works

  1. Single char. BMP overload.
  2. Decimal 65. Same as (int)'A'.
  3. Hex 41. Familiar Unicode notation.
  4. Simple path. No surrogates involved.

Example 2 — Pair to 1F600

Convert an emoji string to its code point.

C#
using System;

class Program {
    static void Main() {
        string emoji = "\U0001F600";
        int cp = Char.ConvertToUtf32(emoji, 0);
        Console.WriteLine(cp.ToString("X"));
    }
}

How It Works

  1. String index. Starts at the high surrogate.
  2. Reads both units. Produces the full scalar.
  3. Hex output. 1F600.
  4. Validate first. IsSurrogatePair is a good guard in production.

Example 3 — From and To UTF-32

Convert both directions.

C#
using System;

class Program {
    static void Main() {
        int cp = 0x1F600;
        string s = Char.ConvertFromUtf32(cp);
        int back = Char.ConvertToUtf32(s, 0);
        Console.WriteLine(back == cp);
        Console.WriteLine(back.ToString("X"));
    }
}

How It Works

  1. From UTF-32. Build the string.
  2. Back to UTF-32. ConvertToUtf32 restores the value.
  3. Equality true. Round trip succeeds.
  4. Stable code point. Hex still 1F600.

Frequently Asked Questions

No—use the pair or string overload.
65 (0x41).
ConvertFromUtf32.
Invalid pairs or bad indexes.
Yes: ConvertToUtf32(char).

Next: Equals()

Return true when two characters have the same UTF-16 value with System.Char.

Equals() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful