The legality of being on a beach at night varies depending on the specific location and local regulations. In many places, public beaches are subject to local laws and ordinances that may restrict access during certain hours, including nighttime. These restrictions are often in place for safety and security reasons.