Since 1963, the ferry line Baku (Azerbaijan) - Turkmenbashi, former Krasnovodsk (Turkmenistan) connected both cities across the Caspian Sea.
Up to 8 vessel of the Class "Dagestan" are operated on the line in the presence of freight: "Ak. Topchubashov", "Azerbaijan","Dagestan","Ak. G. Aliev", "Prof. Gul", "Nakhichevan", "Mercury-1" and "Mercury-2". Two latter ships are rather new, they were built in Kaliningrad. All vessels are in operation under the flag of Azerbaijan. Each ferry capacitates 27 railcars and 200 passengers. The cities lay practically on the same parallel at the distance 306 km. Time on the route is 12 around hours. For comparison, planned term of delivery freight from Baku to Ashgabat around the Caspian Sea, via RZD, Kasakhstan and Uzbekistan Railways exceeds a week.
There are no scheduled ferry services between Azerbaijan and Turkmenistan so people have to rock up and take their luck. When the ferry leaves depends on many factors: weather conditions, how many tickets been sold, etc. Another reason they for the ferry not departing could be waiting for a train cargo that migth take days to arrive. Keep in mind, the ferry is mainly for freight and won’t take passengers if it isn’t loaded with freight.
If you can handle the uncertainty of ferry travel and have some time flexibility (if you plan leave Azerbaijan by ferry ALWAYS make sure that you have extra days in your visa just in case), we highly recommend taking the slow boat across the Caspian [to Turkmenbashi (Turkmenistan) or to Aktau (Kazakhstan)]. The sunset alone is worth the trip and offers a dazzling display that you are unlikely to encounter anywhere else. Moreover, the ferry offers an ideal slow-paced transition into unusual Turkmenistan.
Ideally, there is a daily ferry service between Baku and Turkmenbashi (Turkmenistan). Some delays might happen but usually you might be pretty sure that you won't get stuck in the port for more than 2-3 days. Service between Baku and Aktau (Kazakhstan) is less frequent and harder to predict. Generally ferry runs 2-3-4 times a week, frequency depends on cargo volumes. Tickets for both itineraries could be bought only in the morning at ticket office at the day when ferry leaves. NO PRELIMINARY bookings are available. It's a matter of going to the ferry terminal everyday and asking "Is there a boat today?". They will only sell tickets once there's a confirmed sailing. Also, bear in mind that the boat takes anywhere between 18-48 hours to cross the sea, so make sure that you have enough time with your visa. Turkmen transit visas are 5 days, and they are date specific, so that moment might be really tricky.