
Ljubljana to Koper — over the Karst to the Adriatic
Nelso Silva / Wikimedia Commons · CC BY-SA 2.0 · cropped
- DistanceLjubljana–Koper · about 150 km
- DurationAbout 2 hours 40 minutes
- Best seasonSpring to autumn — mild coast, green Karst; summer is busiest on the coast
Introduction
Slovenia's coastline is famously short — barely forty-six kilometres of Adriatic squeezed between Italy and Croatia — and only one town on it has a railway station. That town is Koper, and the line that reaches it is the country's single train to the sea. It is not a heritage spectacle or a named luxury express; it is an ordinary intercity service. But the journey it makes, from the capital across the Karst and down to the Mediterranean, is one of the most satisfying in the country, and it strings together some of Slovenia's greatest sights along the way.
The train leaves Ljubljana and climbs steadily south-west onto the Karst plateau — the Kras, a pale expanse of limestone so riddled with caves, sinkholes and vanishing rivers that geographers borrowed its name for every such landscape on earth. This is the country of the great show caves: Postojna, reached from its own station and explored by an underground railway, and the UNESCO-listed Škocjan Caves near Divača, with their colossal subterranean canyon.
Beyond Divača the railway tips over the edge of the plateau and begins a long, curving descent toward the coast. The Gulf of Trieste opens up ahead, the air turns soft and salty, and the line drops down through Črnotiče to sea level at Koper — a Venetian-flavoured old town wrapped around Slovenia's one great cargo port, cypress trees and campaniles giving way to container cranes.
Koper is the end of the tracks, but not of the coast. From the station a short bus runs on around the shore to Izola, Portorož and, loveliest of all, Piran, a perfect little Venetian town on its headland. Ride the train for the Karst and the caves, then let the bus finish the job — the classic Slovenian day out, capital to Riviera before lunch.
The Journey
Out of the capital and onto the Karst
The run to the coast begins on one of the oldest railways in the region. The stretch from Ljubljana through Postojna to Divača is part of the historic Southern Railway, the Austrian main line that first linked Vienna to Trieste back in 1857 — the artery that opened up the whole Karst to the wider world. Leaving Ljubljana the train crosses the marshy plain south of the city and then begins to climb, the countryside drying out and paling as it rises onto the Karst plateau.
This is limestone country in its purest form: bare grey rock, stone-walled villages, red-roofed farms and vineyards, and everywhere the tell-tale signs of a landscape being quietly dissolved from within — sinkholes, dry valleys, and rivers that plunge underground to run for miles in the dark. It is no accident that geologists the world over call all such terrain "karst": they took the word straight from here.
The country of caves
The plateau holds two of the most famous caves on the planet, and the railway serves them both. At Postojna — a stop on the line, with the cave a short way from the station — an underground electric railway carries visitors deep into a fairy-tale world of stalactites and vast chambers, one of the most visited caves in Europe. A little further on, near Divača, lie the Škocjan Caves, a UNESCO World Heritage Site where the Reka river has carved one of the largest underground canyons anywhere, crossed by dizzying footbridges high above the water.
At Divača the coast branch turns off from the old Trieste main line. This part of the route — the 49 kilometres down to Koper — is much younger: it was opened only in 1967–68, built above all to carry freight to Slovenia's brand-new deep-water port. It is a hard-working railway, and you will share the tracks with long container and ore trains grinding up from the sea. A newer, shorter tunnel line alongside it is being brought into use to add capacity for that freight.
Down to the sea
The last act is the best. Beyond Divača and Hrpelje-Kozina the railway reaches the lip of the plateau and begins its long descent to the Adriatic, curving down the steep hillside through cuttings and short tunnels. Somewhere around Črnotiče the view suddenly opens: the Gulf of Trieste spread out below, the sea a hard blue line, the hills of Istria beyond. The train loses height steadily all the way down to sea level.
It ends at Koper — Capodistria to the Italians who ruled it for centuries — a compact old town of Venetian palaces and a fine central square, now fused to the busy quays of the Port of Koper. The buffer-stops are almost within sight of the water. For most travellers this is a beginning as much as an end: the coast runs on to Izola, Portorož and Piran, and a local bus is waiting outside to take you there.







Along the route
Kabelleger / David Gubler / Wikimedia Commons · CC BY-SA 3.0Across the Karst
The heart of the ride is the Karst — the pale, cave-riddled limestone plateau that gave its name to all such landscapes on earth. The line runs across it through a country of stone villages, vineyards and hidden rivers that vanish underground and reappear miles away.
Jakub Hałun / Wikimedia Commons · CC BY 4.0The great show caves
Two of the world's most famous caves lie right on the line. Postojna Cave has its own station and is explored by an underground train; near Divača, the UNESCO-listed Škocjan Caves hide a colossal underground canyon carved by the Reka.
Marek Ślusarczyk (Tupungato) / Wikimedia Commons · CC BY 3.0Down to the Adriatic
Beyond Divača the railway tips over the edge of the plateau and begins its long curving descent, with the Gulf of Trieste opening ahead. It ends at Koper, a Venetian-flavoured old town wrapped around Slovenia's one great port.A bit of history
Culture & experiences along the way
domjisch / Wikimedia Commons · CC BY 2.0Ride straight to the sea
Around six direct trains a day make the run from Ljubljana to Koper in about two hours forty, for a handful of euros. Sit on the right for the best of the Karst and the first glimpse of the Adriatic on the descent. It is the easiest way to swap Slovenia's capital for its coast in a single morning.
Jakub Hałun / Wikimedia Commons · CC BY 4.0Break the journey for a cave
The line's best trick is to turn the trip into two adventures. Alight at Postojna for its cave and hilltop castle, or at Divača for the Škocjan Caves, then carry on to the coast on a later train. Check the timetable so you can time your descent underground to a returning service.
Jakub Hałun / Wikimedia Commons · CC BY 4.0On to Piran
The train stops at Koper, but the coast runs on. From the station, a short local bus carries you round the shore to Izola, Portorož and lovely Piran, the little Venetian town on its headland. It is the classic Slovenian day: Karst by rail, Riviera by bus.Timetables
The train to the coast is a regular Slovenske železnice intercity service, so no special ticket or booking is needed — you can simply turn up and travel. About six direct trains a day run between Ljubljana and Koper, taking a little under three hours; on some services you may need to change at Divača or Pivka, so aim for the direct departures where you can.
Ljubljana → Koper (direct trains)
Departures as of July 2026 (timetable valid to December 2026):
| Depart Ljubljana | Arrive Koper | Journey |
|---|---|---|
| 05:23 | 08:14 | ~2 h 51 |
| 06:00 | 08:49 | ~2 h 49 |
| 06:45 | 09:37 | ~2 h 52 |
| 09:10 | 11:50 | ~2 h 40 |
| 15:20 | 18:01 | ~2 h 41 |
| 17:50 | 20:34 | ~2 h 44 |
Trains call at Postojna, Pivka and Divača among other stops. The reverse direction, Koper → Ljubljana, runs to a similar spread through the day. Fares are inexpensive — a few euros end to end — and reservations are not required.
Breaking the journey and reaching the coast
To visit a cave, get off at Postojna (for Postojna Cave) or Divača (for the Škocjan Caves, a little way from the station), then continue to the coast on a later train — check the day's times so you are not left waiting long between services.
The railway ends at Koper. For Izola, Portorož and Piran, walk out to the bus stops by the station and take a short local bus along the coast (roughly half an hour to Piran). Always confirm current times on the Slovenske železnice timetable before travelling, as engineering works — including on the coast line — can alter services.
Tickets
Riding to the coast could hardly be simpler. This is an everyday Slovenske železnice service, so a standard ticket — from a window, a machine or the SŽ site and app — is all you need, and there is no compulsory reservation on the domestic trains. Ljubljana to Koper covers the whole run over the Karst to the sea for a few euros, and where a direct train is not running at the hour you want, the journey takes an easy timed change at Divača or Pivka on the same ticket.
Because fares are low it is worth building in a stop: buy to Koper and break the journey at Postojna or Divača for the caves, then board a later service. Cave entry is booked separately and worth reserving in high season. The train ends at Koper; the onward bus to Izola, Portorož and Piran is a separate fare.
Book your tickets

Ljubljana – Koper direct train
The everyday intercity to the coast
Around six direct Slovenske železnice trains a day run Ljubljana–Koper in about two hours forty, over the Karst and down to the Adriatic. No reservation needed on most services; buy at the station or on the SŽ website and app. Tickets cost only a few euros.
Book Tickets (opens in a new tab, on Slovenske železnice (Slovenian Railways))via Slovenske železnice (Slovenian Railways)
Timetable & connections
Plan a cave stop or the bus to Piran
Check current departures on the Slovenske železnice timetable so you can break the journey at Postojna or Divača for the caves, then pick up a later train — and note the onward bus from Koper to Izola, Portorož and Piran. Times can change for engineering works.
Book Tickets (opens in a new tab, on Slovenske železnice (Slovenian Railways))via Slovenske železnice (Slovenian Railways)Rail Passes
Content coming soon.
Places to Visit
Few short train rides link so many first-rate sights. The line to the coast is really a string of destinations, and it rewards anyone willing to hop off along the way.
The two that need no introduction are underground and both have their own stations on the line: Postojna Cave, where a little electric train trundles visitors through kilometres of dripstone galleries, and, from Divača, the Škocjan Caves, whose vast underground gorge is a UNESCO World Heritage Site and one of the natural wonders of Europe. The Karst between them is also the country of pršut ham and teran wine.
At the end of the line the rest of the coast is a short bus away — Izola's fishing harbour and the belle-époque resort of Portorož with its beaches — while back at the start, Ljubljana deserves a day of riverside cafés and the hilltop castle before you go anywhere at all.
Thomas Ledl / Wikimedia Commons · CC BY-SA 4.0 · croppedLjubljana
A capital you can cross on foot, wrapped around a willow-lined river with a castle on the hill above. The Dragon Bridge is its emblem: work started 1 July 1900, it opened in 1901 as the Jubilee Bridge of Emperor Franz Joseph I, and it was renamed in July 1919 after the four copper dragons on its corners. It was one of Europe's earliest reinforced-concrete bridges, and its 33.34-metre arch was the third largest on the continent when it opened.
Jakub Hałun / Wikimedia Commons · CC BY 4.0 · croppedPredjama Castle
A castle built into the mouth of a cave, and the best sight on this line after the caves themselves. The present Renaissance front dates from 1570, but the story people come for is older: the robber baron Erazem of Predjama, besieged by imperial troops, kept himself supplied through a natural shaft enlarged to reach the clifftop 25 metres away — and went on raiding throughout. The cliff is 123 metres high, and the cave beneath opens only from June to August, around the bats.
Keith Roper / Wikimedia Commons · CC BY 2.0 · croppedLipica
Every Lipizzaner in the world traces back to this one Karst village. Archduke Charles of Inner Austria founded the stud in 1580, and the first Spanish horses — 24 broodmares and six stallions — arrived in 1581; the limestone and the climate were judged close enough to Spain to work. The foals are born dark and whiten with age. Staff still plant a linden tree for every foal born, which is what the village is named after.
Plamen Agov / Wikimedia Commons · CC BY-SA 3.0 · croppedPiran
The prettiest town on the Slovenian coast, and its centre is not a square at all by origin — it was the inner harbour, filled in and paved over in 1894 once the sewage became intolerable. The oval of pale stone that replaced it is ringed by Venetian palaces and named for the violinist Giuseppe Tartini, born here; the bronze of him at the centre was cast in 1896 by Antonio Dal Zotto. A short bus from the railhead at Koper.
Earnest B / Wikimedia Commons · CC BY-SA 3.0 · croppedKoper
Journey's end is a working container port wrapped around a Venetian old town. The 15th-century Praetorian Palace on the main square began as two 13th-century houses joined by a loggia and ended as Venetian Gothic; it holds the tourist office now, so you can walk straight in. Koper was capital of Venetian Istria — Caput Histriae — and its cathedral, begun in the later 12th century, has one of the oldest bells in Slovenia, cast in 1333.
Yerpo / Wikimedia Commons · CC BY-SA 4.0 · croppedThe Sečovlje salt pans
Salt is still raked here by hand, the way the salters have always done it, and the 650 hectares at the mouth of the Dragonja are now a landscape park. The working evaporation ponds cover 16.1 hectares of that; the rest is a maze of dykes, channels and abandoned salters' houses that has become one of the best bird sites on the Adriatic — flamingos included. It sits on the Croatian border beyond Portorož, an easy bus from Piran.Where to Sleep
The line lets you sleep in three very different Slovenias — city, cave country, or coast — all within a couple of hours of one another.
Ljubljana is the obvious base at the inland end, with everything from design hotels and riverside boutiques to hostels and apartments in the old town. Stay central and you can walk to the castle, the market and the cafés along the river.
On the Karst, Postojna and the surrounding villages offer guesthouses, farm stays and small hotels — a good option if you want an early start at the caves or a taste of the region's ham and wine, and quieter (and cheaper) than the coast in summer.
At the sea, Koper has practical town hotels within reach of the station, handy if you are travelling on early or arriving late. But most visitors push on to the coast towns: Portorož for full-blown resort hotels and spas, and Piran for characterful small hotels and rooms in the lanes of the old town — book well ahead for Piran in high season, as space inside the walls is limited and much in demand.
With cheap trains and a short coast bus, it is easy to stay in one place and range out along the line, whether your idea of Slovenia is a city, a cave or a sunset over the Adriatic.
Comments
Facebook comments
Facebook will see your IP address and can set cookies. If you are signed in to Facebook it can connect this visit to your account.
Loads Facebook (Meta) content from now on, across the site. Undo this at any time.