A positively charged nanofiltration (NF) membrane was fabricated to enhance the separation of Mg2+ ions over Na+ ions in seawater. The NF membrane (PEI-CC/PES) was prepared from interfacial polymerization (IP) of cyanuric chloride (CC) and polyethyleneimine (PEI) on a polyether sulfone (PES) ultrafiltration membrane. Membrane analysis established the successful synthesis of positively charged PEI-CC/PES membrane (18–50 mV at pH 3.0–7.5). Negatively charged membranes are not well-suited for divalent cation rejection due to strong electrostatic attraction. The PEI-CC/PES membrane demonstrated superior performance, achieving 5.7 times higher Mg2+/Na+ separation (SFMg/Na) than commercial (NP010 and NP030) membranes in a model solution. PEI-CC/PES membrane exhibited a SFMg/Na of 1.26 with seawater as feed and a permeate flux of 4.6 L m−2 h−1. Acidic seawater increased the positive charge of the synthesized membrane surface at a low pH (pH 3.0 ± 0.4), which resulted in a higher SFMg/Na value. Compared to HCl and H2SO4-treated seawater, oxalic acid-treated seawater reduced concentration of Ca2+ ions by 92–95 %. This condition significantly increased SFMg/Na by 62 % compared to the original seawater. Overall, these results demonstrate the effectiveness of a positively charged membrane coupled with reduced Ca2+ ion concentration in seawater to promote superior Mg2+ over Na+ separation.