In C#, Convert.ToDouble returns a double—a 64-bit binary floating-point number.
Use it for scientific values and general real numbers. For money, prefer ToDecimal.
This is a static member of System.Convert. You call it with the type name, such as Convert.ToDouble(...). Convert is the everyday API for converting between common CLR types in C#.
Syntax
Convert text or numbers into double.
C#
double a = Convert.ToDouble("3.14");
double b = Convert.ToDouble(2);
double c = Convert.ToDouble("1.5E2");
Call
What it does
Convert.ToDouble("3.14")
Decimal digit string → double.
Convert.ToDouble("1.5E2")
Scientific notation → 150.
null → 0. Bad format → FormatException. Culture affects the decimal separator.
Library declarations
C#
public static double ToDouble(string? value);
public static double ToDouble(int value);
public static double ToDouble(object? value);
Parameters
Parameter
Description
value
Required. Text or number to convert.
Return Value
Return Value
Description
double
64-bit floating-point result.
C# Examples
Example 1 — Parse a Real Number
Convert a simple fractional string.
C#
using System;
class Program {
static void Main() {
double x = Convert.ToDouble("3.14");
Console.WriteLine(x);
Console.WriteLine(x * 2);
}
}
Output
3.14
6.28
How It Works
Fractional text."3.14" becomes a double.
Scale. Multiplying by 2 prints 6.28.
Common path. Strings from files often need ToDouble.
Null → 0. Convert is null-friendly for numeric To*.
Example 2 — Read Scientific Notation
Parse an exponent-style number.
C#
using System;
class Program {
static void Main() {
double x = Convert.ToDouble("1.5E2");
Console.WriteLine(x);
Console.WriteLine(Convert.ToDouble("2e-1"));
}
}
Output
150
0.2
How It Works
E2 means ×100. 1.5×10² equals 150.
Negative exponent. 2e-1 equals 0.2.
Case of e. Upper or lower E both work.
Still double. Result type remains 64-bit float.
Example 3 — Add Int and Double Text
Convert an int and a string, then add.
C#
using System;
class Program {
static void Main() {
double a = Convert.ToDouble(5);
double b = Convert.ToDouble("2.5");
Console.WriteLine(a + b);
}
}
Output
7.5
How It Works
Int widens. 5 becomes 5.0 as double.
String parse."2.5" becomes 2.5.
Sum. Together they print 7.5.
One type. Convert keeps both operands as double before adding.