OpenLayers has the ability to read and write geographic data in several different formats: KML, GML, GeoRSS (Simple and GML), GeoJSON, WKT. One of the things that hasn’t thus far been exploited as a result of this is the use of OpenLayers as a format conversion tool… until today.
OpenLayers Data Conversion is a new service that allows easy conversion from any of the formats that OpenLayers supports to any of the formats that OpenLayers supports. Simply paste your data, choose your format, and hit convert. Additionally, this tool supports reprojection to and from Spherical Mercator, the internal coordinate system used in Google Maps.
This code isn’t quite in trunk of OpenLayers yet, but in the meantime, you can grab the example from an svn sandbox, including the prebuilt lightweight OpenLayers build for format conversion.