C# Convert ToSingle() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Convert

Definition

In C#, Convert.ToSingle returns a float (32-bit binary floating-point number), also called Single.

It is smaller and less precise than double. Use ToDouble when you need more precision.

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

Syntax

Convert text or numbers into a float.

C#
float a = Convert.ToSingle("2.5");
float b = Convert.ToSingle(3);
float c = Convert.ToSingle("1e2");
CallWhat it does
Convert.ToSingle("2.5")Fractional string → float.
Convert.ToSingle("1e2")Scientific notation → 100.

null → 0. Culture affects decimal separators. Prefer float.TryParse for soft failure.

Library declarations
C#
public static float ToSingle(string? value);
public static float ToSingle(double value);
public static float ToSingle(object? value);

Parameters

ParameterDescription
valueRequired. Text or number to convert.

Return Value

Return ValueDescription
float32-bit floating-point result.

C# Examples

Example 1 — Parse a Float

Convert a simple fractional string to Single.

C#
using System;

class Program {
    static void Main() {
        float x = Convert.ToSingle("2.5");
        Console.WriteLine(x);
        Console.WriteLine(x * 4);
    }
}

How It Works

  1. Single width. Result is 32-bit float.
  2. 2.5 text. Parses into floating value.
  3. ×4. Prints 10.
  4. Null → 0. Convert stays null-friendly.

Example 2 — Exponent Form

Read scientific notation into float.

C#
using System;

class Program {
    static void Main() {
        float x = Convert.ToSingle("1.25E1");
        Console.WriteLine(x);
        Console.WriteLine(Convert.ToSingle("5e-1"));
    }
}

How It Works

  1. E1 ×10. 1.25×10 equals 12.5.
  2. Negative exp. 5e-1 equals 0.5.
  3. Compact text. Useful for sensor-style numbers.
  4. Still float. Precision is Single, not Double.

Example 3 — Narrow a Double

Convert a double into float with ToSingle.

C#
using System;

class Program {
    static void Main() {
        double wide = 9.75;
        float narrow = Convert.ToSingle(wide);
        Console.WriteLine(narrow);
        Console.WriteLine(narrow + 0.25f);
    }
}

How It Works

  1. Start wider. Value begins as double.
  2. Narrow. ToSingle packs it into float.
  3. Add quarter. 9.75 + 0.25 equals 10.
  4. Precision loss. Some doubles cannot survive narrowing exactly.

Frequently Asked Questions

ToSingle returns float (32-bit); ToDouble returns double (64-bit).
Yes for typical ToSingle overloads.
No—use decimal.
Yes, forms like 1.5E2 are accepted.
Parse throws on null; Convert returns 0.

Next: ToString()

Convert a value to its string representation with System.Convert.

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

8 people found this page helpful