The Madelung constant is used in determining the electrostatic potential of a single ion in a crystal by approximating the ions by point charges. It is named after Erwin Madelung, a German physicist.
 Because the anions and cations in an ionic solid attract each other by virtue of their opposing charges, separating the ions requires a certain amount of energy. This energy must be given to the system in order to break the anion–cation bonds. The energy required to break these bonds for one mole of an ionic solid under standard conditions is the lattice energy.
 The Madelung constant allows for the calculation of the electric potential Vi of the ion at position ri due to all other ions of the lattice 
 where 
  
    
      
        
          r
          
            i
            j
          
        
        =
        
          |
        
        
          r
          
            i
          
        
        −
        
          r
          
            j
          
        
        
          |
        
      
    
    {\displaystyle r_{ij}=|r_{i}-r_{j}|}
  
 is the distance between the ith and the jth ion. In addition,
 If the distances rij are normalized to the nearest neighbor distance r0, the potential may be written
 with Mi being the (dimensionless) Madelung constant of the ith ion
 Another convention is to base the reference length on the cubic root w of the unit cell volume, which for cubic systems is equal to the lattice constant. Thus, the Madelung constant then reads
 The electrostatic energy of the ion at site ri then is the product of its charge with the potential acting at its site
 There occur as many Madelung constants Mi in a crystal structure as ions occupy different lattice sites. For example, for the ionic crystal NaCl, there arise two Madelung constants – one for Na and another for Cl. Since both ions, however, occupy lattice sites of the same symmetry they both are of the same magnitude and differ only by sign. The electrical charge of the Na+ and Cl− ion are assumed to be onefold positive and negative, respectively, zNa = 1 and zCl = –1. The nearest neighbour distance amounts to half the lattice constant of the cubic unit cell 
  
    
      
        
          r
          
            0
          
        
        =
        
          
            
              a
              2
            
          
        
      
    
    {\displaystyle r_{0}={\tfrac {a}{2}}}
  
 and the Madelung constants become
 The prime indicates that the term 
  
    
      
        j
        =
        k
        =
        ℓ
        =
        0
      
    
    {\displaystyle j=k=\ell =0}
  
 is to be left out. Since this sum is conditionally convergent it is not suitable as definition of Madelung's constant unless the order of summation is also specified. There are two "obvious" methods of summing this series, by expanding cubes or expanding spheres. Although the latter is often found in the literature,
 it fails to converge, as was shown by Emersleben in 1951. The summation over expanding cubes converges to the correct value, although very slowly. An alternative summation procedure, presented by Borwein, Borwein and Taylor, uses analytic continuation of an absolutely convergent series.
 There are many practical methods for calculating Madelung's constant using either direct summation (for example, the Evjen method) or integral transforms, which are used in the Ewald method. A fast converging formula for the Madelung constant of NaCl is
 The continuous reduction of M with decreasing coordination number Z for the three cubic AB compounds (when accounting for the doubled charges in ZnS) explains the observed propensity of alkali halides to crystallize in the structure with highest Z compatible with their ionic radii. Note also how the fluorite structure being intermediate between the caesium chloride and sphalerite structures is reflected in the Madelung constants.
 It is assumed for the calculation of Madelung constants that an ion's charge density may be approximated by a point charge. This is allowed, if the electron distribution of the ion is spherically symmetric. In particular cases, however, when the ions reside on lattice site of certain crystallographic point groups, the inclusion of higher order moments, i.e. multipole moments of the charge density might be required. It is shown by electrostatics that the interaction between two point charges only accounts for the first term of a general Taylor series describing the interaction between two charge distributions of arbitrary shape. Accordingly, the Madelung constant only represents the monopole-monopole term.
 The electrostatic interaction model of ions in solids has thus been extended to a point multipole concept that also includes higher multipole moments like dipoles, quadrupoles etc. These concepts require the determination of higher order Madelung constants or so-called electrostatic lattice constants. The proper calculation of electrostatic lattice constants has to consider the crystallographic point groups of ionic lattice sites; for instance, dipole moments may only arise on polar lattice sites, i. e. exhibiting a C1, C1h, Cn or Cnv  site symmetry (n = 2, 3, 4 or 6). These second order Madelung constants turned out to have significant effects on the lattice energy and other physical properties of heteropolar crystals.
 The Madelung constant is also a useful quantity in describing the lattice energy of organic salts.  Izgorodina and coworkers have described a generalised method (called the EUGEN method) of calculating the Madelung constant for any crystal structure.