Abstract. We show that every n-quasiflat in an n-dimensional CAT (0) cube complex is at finite Hausdorff distance from a finite union of n-dimensional orthants. Then we introduce a class of cube complexes, called weakly special cube complexes and show that quasi-isometries between their universal covers preserve top dimensional flats. This is the foundational towards the quasi-isometry classification of right-angled Artin groups with finite outer automorphism group.Some of our arguments also extend to CAT (0) spaces of finite geometric dimension. In particular, we give a short proof of the fact that a top dimensional quasiflat in a Euclidean building is Hausdorff close to finite union of Weyl cones, which was previously established in [KL97b, EF97, Wor06] by different methods.