FOLLOW US
softpcapps Software CODE HELP BLOG



Freeware Open Source Windows Software Applications and Free Online Tools

For Windows 11 : Download and run .NET 3.5 Installer if the application is not running

How to Convert HEX to String

To convert an HEX string (hexademical string) to its normal format you can do the following :
	

	public string HexToString(string enctxt)
	{ 	
		// you can use here your desired encoding
		Encoding enc = System.Text.Encoding.UTF8;                                

        string hexString = enctxt.Replace(" ","");
	   
		var bytes = new byte[hexString.Length / 2];
		
		for (var i = 0; i < bytes.Length; i++)
		{
			bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
		}

		string str = enc.GetString(bytes);
		
		return str;
	}