Click here to Skip to main content
14,580,573 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have A 25 digit decimal values like 1011406131533376933715533 and I want to convert it into Hexadecimal vice verse.
please help me..

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1


For very large numbers, use a BigInteger (supported in .NET 4.5, 4 and .NET 4 Client Profile):[^]
// add a reference to System.Numerics.dll, then add this line at the top of your code file:
using System.Numerics;

// decimal to hex:
BigInteger dec = BigInteger.Parse("1011406131533376933715533");
string hex = dec.ToString("X");
Console.WriteLine(hex); // output: 0D62C6FAE52427AB5DE4D

// hex to decimal:
string hex2 = "0D62C6FAE52427AB5DE4D";
BigInteger dec2 = BigInteger.Parse(hex2, System.Globalization.NumberStyles.HexNumber);
Console.WriteLine(dec2); // output: 1011406131533376933715533

Hope this helps.
CPallini 21-Jun-13 7:35am
Thomas Daniels 21-Jun-13 7:36am
Thank you!
Member 10273293 8-Jul-15 4:26am
is there any biggest data type conpair the bigintger
because i have a hexa value like this 45203795024b66627559a4754ff677f54cbc360bc37fc91e00ca66e1b843878fe
Thomas Daniels 8-Jul-15 4:32am
What do you mean exactly? Why doesn't BigInteger work for that hex value?
Member 10273293 8-Jul-15 5:20am
i need some more bigger data type because my hexa value is 64 char or more here is the example
Thomas Daniels 8-Jul-15 5:20am
BigInteger is the biggest type you can have. It does not have problems with huge values unless your computer runs out of memory.
Member 10273293 8-Jul-15 5:23am
ok i try for this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100