The left-back has agreed terms at the Moss Rose after impressing during the pre-season friendly against Wigan Athletic.
The former Birmingham City left-back, who can also play further forward on the wing, made forty appearances for the Championship club over a four-year spell around the first-team at St Andrews after breaking through from the youth team.
Only aged 22, Hancox made a loan move to Crawley Town last season and made sixteen appearances for the League Two side, scoring 2 goals before returning to St Andrews and seeing his contract expire.
Hancox will now look to continue his development with the Silkmen where he will provide competition for David Fitzpatrick in the left-back position.