I took a train to Sorrento and boarded the ferry from there to Capri, cost of a return ticket is 37 euro. The ferry takes 30 min and runs about every hour, you don’t have to book in advance and you can get on any ferry regardless of the time on your ticket. To get from the Sorrento train station which is on a cliff down to the port involves climbing down a very long steep set of stairs, coming back I used the elevator cost 1 euro, first you have to find it, just ask a local.
The ferry arrives at Marina Grande which is the main port on the island, from there you can book boat tours around the island (16 euro) and to the Blue Grotto. There is also a Funicular that will take you up to Capri for 2 euro or a bus for the same price. You can also get a bus to Anacapri from the port for 2.50 euro or from Capri for 2 euro. The round the island boat tour takes you past the Blue Grotto but will not stop there for long because you have to transfer to a small row boat to get into the Grotto and it cannot wait that long. So you return to the port and get another dedicated Blue Grotto boat and come back, took about 2 hours for me because of the queue to get into the Grotto. Entrance to the Blue Grotto is 14 euro and I tipped the boat man another 5 euro. A very busy day.