C# Convert ToDouble() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Convert

Definition

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");
CallWhat 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

ParameterDescription
valueRequired. Text or number to convert.

Return Value

Return ValueDescription
double64-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);
    }
}

How It Works

  1. Fractional text. "3.14" becomes a double.
  2. Scale. Multiplying by 2 prints 6.28.
  3. Common path. Strings from files often need ToDouble.
  4. 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"));
    }
}

How It Works

  1. E2 means ×100. 1.5×10² equals 150.
  2. Negative exponent. 2e-1 equals 0.2.
  3. Case of e. Upper or lower E both work.
  4. 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);
    }
}

How It Works

  1. Int widens. 5 becomes 5.0 as double.
  2. String parse. "2.5" becomes 2.5.
  3. Sum. Together they print 7.5.
  4. One type. Convert keeps both operands as double before adding.

Frequently Asked Questions

No. Prefer decimal/ToDecimal for currency.
Yes for typical ToDouble overloads.
Yes—scientific notation is supported.
FormatException is thrown.
Parse throws on null; Convert returns 0.

Next: ToHexString()

Encode bytes as a hexadecimal string (.NET 5+) with System.Convert.

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

11 people found this page helpful