int value = 30; int factor = 16; int nearestMultiple = (int)Math.Round( (value / (double)factor), MidpointRounding.AwayFromZero ) * factor;