In this paper, a 3D molecular dynamics (MD) simulation is performed to investigate the nanoindentation process, the most frequently used technique to measure mechanical properties such as hardness, of three Al/Mg intermetallic compounds, where Mg is the main element added to pure Al. To further improve the understanding of the mechanical response, in this study, we examine the hardness-strength data for three kinds of typical materials, including [Formula: see text]-Al3Mg2 and [Formula: see text]-[Formula: see text][Formula: see text] and [Formula: see text]-[Formula: see text][Formula: see text] phases with different microstructures. In terms of the observed morphologies around the indentations, the influencing variables of the general link between strength and hardness are described. Accordingly, atomic simulations in this paper are performed under the same loading ([Formula: see text]) using a spherical diamond indenter. At both the [Formula: see text]-[Formula: see text][Formula: see text] and [Formula: see text]-[Formula: see text][Formula: see text] phases, we can see that the indenter generates a bigger deformation zone and a greater number of dislocations in the [Formula: see text] direction. The simulation findings show that the microstructure has an impact on the shape of the deformation in each phase. After the deformation process, we get the depth-displacement ([Formula: see text]–[Formula: see text]) curves to describe the mechanical behavior of [Formula: see text]-Al3Mg2, [Formula: see text]-[Formula: see text][Formula: see text] and [Formula: see text]-[Formula: see text][Formula: see text] phases. From the [Formula: see text]–[Formula: see text] curves, we got the radial distribution function, mechanical properties, such as micro hardness, Yield point and maximum load are determined and presented. According to the findings, the chemical composition of these phases has a considerable impact on their characteristics. These [Formula: see text]–[Formula: see text] curves obtained show a rapid increase in loading up to a maximum. The deformation behavior of −Al3Mg2 and −[Formula: see text][Formula: see text] phases under nanoindentation is slightly identical, and they have also a high elasticity limit, the ability to endure deformation and the characteristic of being very ductile and malleable. While [Formula: see text]-[Formula: see text][Formula: see text] phase was shown to be brittle and weak under the same uniaxial nanoindentation loading compared to other phases, it was found that there is a good correlation between the previous simulated studies.