UK coastline shapefile?

My number one source for shapefiles is DIVA-GIS, simply select your country (United Kingdom) and subject (Administrative areas).

Unzip the downloaded file and you should see 3 polygon shapefiles with differing top-levels. The layer GBR_adm0 contains a single polygon of the UK:

UK polygon shapefile

If you wish, you can convert this to a line shapefile (I used QGIS 2.6):

UK line shapefile

For the free Ordnance Survey data, go to Click on the big button at the top labelled "Order Now". On the new page, scroll down until you see Boundary Line. Each dataset has a number of check boxes for ordering options. Boundary line is only offered for the whole of the Great Britain so you only get two check boxes. The one on the left is to order on DVD and the one on the right is to download. I'd recommend the download option. Check the box then scroll to the bottom and click the big blue button marked "Next". On the next page fill in your details and then click "Continue". You will then get an email with the download link.

The coastline in the OS Boundary-Line data is a high-res representation of the mean high water. However, it is a polyline. Do not try to convert this to a polygon. Britain is composed of a convoluted coastline and thousands of satellite islands, peninsulas and rocky out-crops. This means that even a seriously powerful computer is likely to fail to stitch the polyline into a set of polygons (I know because I've tried!). Use one of the political boundary maps instead and dissolve all the polygons to get just the coast.

A great alternative is either the OSM data already mentioned in another reply or the GSHHG shorelines dataset (formerly known as GSHHS). This is global but comes in a series of resolutions. It is a big download though.

I use

It's in lat/long format, rather than OSGR format.

It covers the entire planet, but Shapefiles are a fairly simple format, so it's possible to write a smallish program to filter by latitude and longitude.