The dynamics of large amounts of dislocations is the governing mechanism in metal plasticity. The free energy of a continuous dislocation density profile plays a crucial role in the description of the dynamics of dislocations, as free energy derivatives act as the driving forces of dislocation dynamics. In this contribution, an explicit expression for the free energy of straight and parallel dislocations with different Burgers vectors is derived. The free energy is determined using systematic coarse-graining techniques from statistical mechanics. The starting point of the derivation is the grand-canonical partition function derived in an earlier work, in which we accounted for the finite system size, discrete glide planes and multiple slip systems. In this paper, the explicit free energy functional of the dislocation density is calculated and has, to the best of our knowledge, not been derived before in the present form. The free energy consists of a mean-field elastic contribution and a local defect energy, that can be split into a statistical and a many-body contribution. These depend on the density of positive and negative dislocations on each slip system separately, instead of GND-based quantities only. Consequently, a crystal plasticity model based on the here obtained free energy, should account for both statistically stored and geometrically necessary dislocations.