C# Convert ToInt16() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Convert

Definition

In C#, Convert.ToInt16 returns a short (16-bit signed integer) from text or other numeric types.

The range is −32,768 to 32,767. Outside that range throws OverflowException. Unreadable text throws FormatException.

This is a static member of System.Convert. You call it with the type name, such as Convert.ToInt16(...). Convert is the everyday API for converting between common CLR types in C#.

Syntax

Convert text or numbers into a short.

C#
short a = Convert.ToInt16("1000");
short b = Convert.ToInt16(-5);
short c = Convert.ToInt16("1F", 16);
CallWhat it does
Convert.ToInt16("1000")Decimal string → short.
Convert.ToInt16("1F", 16)Hex string with base 16.

null → 0. Prefer short.TryParse for untrusted input. Base overload accepts 2, 8, 10, 16.

Library declarations
C#
public static short ToInt16(string? value);
public static short ToInt16(string? value, int fromBase);
public static short ToInt16(int value);

Parameters

ParameterDescription
valueRequired. Text or number to convert.
fromBaseOptional. 2, 8, 10, or 16.

Return Value

Return ValueDescription
short16-bit signed result.

C# Examples

Example 1 — Parse a Short

Convert a decimal string to Int16.

C#
using System;

class Program {
    static void Main() {
        short n = Convert.ToInt16("250");
        Console.WriteLine(n);
        Console.WriteLine(n + 10);
    }
}

How It Works

  1. Short width. Result type is 16-bit signed.
  2. 250 fits. Well inside ±32767.
  3. Add ten. Shows numeric math on the result.
  4. Null friendly. Convert yields 0 for null numeric inputs.

Example 2 — Hex to Short

Parse a hex string with fromBase 16.

C#
using System;

class Program {
    static void Main() {
        short n = Convert.ToInt16("7FFF", 16);
        Console.WriteLine(n);
        Console.WriteLine(Convert.ToInt16("1010", 2));
    }
}

How It Works

  1. 7FFF hex. Max positive Int16 value 32767.
  2. Binary 1010. Base 2 yields decimal 10.
  3. Same method. fromBase selects the digit alphabet.
  4. Overflow still applies. Values beyond short range throw.

Example 3 — Catch Out-of-Range

Handle a value too large for Int16.

C#
using System;

class Program {
    static void Main() {
        try {
            Console.WriteLine(Convert.ToInt16(40000));
        } catch (OverflowException) {
            Console.WriteLine("outside Int16");
        }
        Console.WriteLine(Convert.ToInt16(32000));
    }
}

How It Works

  1. 40000 too big. Exceeds 32767.
  2. Catch OverflowException. Print a clear status.
  3. 32000 ok. Second call succeeds.
  4. Validate early. TryParse helps for user text.

Frequently Asked Questions

−32768 to 32767.
Yes for typical ToInt16 overloads.
Yes—Convert.ToInt16("1010", 2).
Parse throws on null; Convert returns 0.
When the value cannot fit in 16 bits.

Next: ToInt32()

Convert a value to int (Int32)—the most common Convert call with System.Convert.

ToInt32() 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.

13 people found this page helpful