Salt in the ocean comes from rocks on land.
The rain that falls on the land contains some dissolved carbon dioxide from the surrounding air. This causes the rainwater to be slightly acidic due to carbonic acid (which forms from carbon dioxide and water).
As the rain erodes the rock, acids in the rainwater break down the rock. This process creates ions, or electrically charged atomic particles. These ions are carried away in runoff to streams and rivers and, ultimately, to the ocean. Many of the dissolved ions are used by organisms in the ocean and are removed from the water. Others are not used up and are left for long periods of time where their concentrations increase over time.
Two of the most prevalent ions in seawater are chloride and sodium. Together, they make up over 90 percent of all dissolved ions in the ocean. Sodium and Chloride are 'salty.'
The concentration of salt in seawater (salinity) is about 35 parts per thousand, on average. Stated in another way, about 3.5 percent of the weight of seawater comes from the dissolved salts.
By some estimates, if the salt in the ocean could be removed and spread evenly over the Earth’s land surface it would form a layer more than 500 feet thick, about the height of a 40-story office building.