There are many chemicals in ocean water that make it salty. Most of them get there from rivers carrying chemicals dissolved out of rock and soil. The main one is salt. The salinity of the ocean varies from place to place, especially at the surface. Some parts in the ocean have much rainfall. So, the freshwater gets added to ocean water and dilutes it and reduces its salinity.There are parts which receive less rainfall but warm and dry winds cause a lot of evaporation.  In the process of evaporation the water vapour rises in to the atmosphere.  It leaves the salt behind so the salinity of water increases.