The United Nations Convention on the Law of the Sea took place between 1973 and 1982 and finalized an agreement between its participants on the rights and responsibilities of nations' ocean usage, established guidelines for ocean environment standards, business practices involving the oceans, and marine resource management. As of this year, 166 countries have agreed to the terms set forth by this convention.
Countries have exclusive use and regulation of ocean waters up to 12 nautical miles from shore (14 miles or 22 kilometers). These are called territorial waters. Other countries are allowed "innocent passage" through these waters which means foreign vessels can pass through so long as they do not steal or contaminate resources or intend harm. If two or more countries' territorial waters overlap, the median point between them acts as their border unless the countries agree otherwise.
A further 12 nautical miles out from territorial waters are contiguous waters where a nation can exercise regulation only in taxation, customs, immigration, and pollution. Any water outside of these boundaries is considered "international water" which means all countries have access to them, but cannot utilize or contaminate the resources or in them.