FOLLOW US
softpcapps Software CODE HELP BLOG

Shareware and free Open Source Windows Software Applications and free Online Tools

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;
	}