We present a measurement of the spatial clustering of massive compact galaxies at 1 ≤ z ≤ 3 in CANDELS/3D-HST. We obtain the correlation length and characteristic DM halo masses for compact quiescent galaxies (cQGs) at z ~ 1.5 and compact starforming galaxies (cSFGs) at z ~ 2.5. By comparison with extended starforming galaxies (eSFGs), our result indicates that eSFGs are less possible to be the progenitors of cQGs at lower redshift. Our results indicates that cQGs at z ~ 1.5 could be the progenitors of local luminous ETGs and the descendants of cSFGs and SMGs at z > 2.