How can I Convert a Big decimal number to Hex in C# (Eg : 588063595292424954445828)
The number is bigger than int & long but can be accomodated in Decimal . But the normal ToString or Convert methods don't work on Decimal . I believe this will produce the right results where it returns anything, but may reject valid integers. I dare say that can be worked around with a bit of effort though... (Oh, and it will also fail for negative numbers at the moment.) static string ConvertToHex(decimal d) { int[] bits = decimal.GetBits(d); if (bits[3] != 0) // Sign and exponent { throw new ArgumentException(); } return string.Format("{0:x8}{1:x8}{2:x8}", (uint)bits[2], (uint)bits[1],