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");
public static float ToSingle(string? value);
public static float ToSingle(double value);
public static float ToSingle(object? value);
Parameters
Parameter
Description
value
Required. Text or number to convert.
Return Value
Return Value
Description
float
32-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);
}
}
Output
2.5
10
How It Works
Single width. Result is 32-bit float.
2.5 text. Parses into floating value.
×4. Prints 10.
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"));
}
}
Output
12.5
0.5
How It Works
E1 ×10. 1.25×10 equals 12.5.
Negative exp. 5e-1 equals 0.5.
Compact text. Useful for sensor-style numbers.
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);
}
}
Output
9.75
10
How It Works
Start wider. Value begins as double.
Narrow. ToSingle packs it into float.
Add quarter. 9.75 + 0.25 equals 10.
Precision loss. Some doubles cannot survive narrowing exactly.