Adding Numbers or Letters to Google Maps API Markers

June 4th, 2011 - Posted by Steve Marks to Javascript / jQuery, Web Development.

Adding Numbers or Letters to Google Maps API Markers

I’m a huge fan of the Google Maps API and love the amount of features it has to offer. One thing I get asked quite a lot though and that I can’t find in the documentation is “How do I add numbers or letters to the markers?“.

The Solution

The solution is actually quite simple and simply involves you using an image for the marker icons. As part of Google Chart Tools you can generate markers that contain a letter or number, as well change the marker and font colors.


Let’s put it into practice using a simple demonstration:

<!DOCTYPE html>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
  function initialize() {
    var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
    var myOptions = {
      zoom: 4,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    var marker = new google.maps.Marker({
        position: myLatlng, 
        map: map,
        icon: '|FF0000|000000'
<body onload="initialize()">
  <div id="map_canvas"></div>

Notice the ‘icon’ option when setting up the marker is a link to an image? This URL contains three key parts that effect the look of the marker:

‘A’ – The letter shown on the marker. This can also be a letter, a symbol, or a combination of them all.
‘FF0000’ – The hex color of the marker
‘000000’ – The hex color of the font used

As a result of the above we would get the following:

A Google Maps marker containing a letter

This entry was posted on Saturday, June 4th, 2011 at 8:17 pm by +Steve Marks and is filed under Javascript / jQuery, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.

Fear not, we won't publish this

Comments (20)
  1. vathsala says:

    Thank you for your cod i searched this only

  2. Pablo says:

    Here are custom icons with the updated “visual refresh” style that you can generate quickly via a simple .vbs script. I also included a large pre-generated set that you can use immediately with multiple color options:

  3. Kader says:

    Thanks for sharing this, it was really helpful.

  4. Rajnikant says:

    Great post !!! Like Icing on a cake.

  5. RD says:

    Thank you. This was helpful.


  6. Nat says:

    Thank you so much.
    This solved an issue I’ve been trying to solve for a while.

  7. Glad I could help :)

  8. Somendra Tiwari says:

    i did not getting from anywhere to write text over marker.. i got solution here.. thank you

  9. Anonymous says:

    thank you very much
    this was so useful, I searched about it for a lot of time and didn’t find it
    great thanks :D

  10. Great post… couldn’t find this in the documentation!?

    Thanks :)

  11. Chris says:

    Thanks for posting.

    That API ( is deprecated, but it sounds like it will continue to work until April 2015.

  12. snuffish says:

    You just saved my day mate! Just what I looked for! :)

  13. Bruce C says:

    Thank you for this information. We were going crazy looking for google markers with letters on them.

  14. Tomson says:


    the Google Image Chart API is officially deprecated

  15. Iaron says:

    a great help! thanks!!

  16. bkw says:

    My god why isn’t this in the official docs. Thank you.

  17. Mike says:

    Hey, thanks for this – very simple and works really well!!

  18. Tony says:

    Very informative. Thanks a lot.

  19. Pranay says:

    Nice tip…