--- layout: api title: "v2.1.0 JavaScript Library: L.Icon" categories: api version: v2.1.0 permalink: /api/v2.1.0/l-icon ---

## Icon

Represents an icon to provide when creating a marker.

    var myIcon = L.icon({
    	iconUrl: 'my-icon.png',
    	iconRetinaUrl: 'my-icon@2x.png',
    	iconSize: [38, 95],
    	iconAnchor: [22, 94],
    	popupAnchor: [-3, -76],
    	shadowUrl: 'my-icon-shadow.png',
    	shadowRetinaUrl: 'my-icon-shadow@2x.png',
    	shadowSize: [68, 95],
    	shadowAnchor: [22, 94]
    });

    L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);

`L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default.

### Creation

Factory | Description
--- | ---
`L.icon( <Icon options> options )` | Creates an icon instance with the given options.

### Options

Option | Type | Description
--- | --- | ---
`iconUrl` | `String` | (required) The URL to the icon image (absolute or relative to your script path).
`iconRetinaUrl` | `String` | The URL to a retina sized version of the icon image (absolute or relative to your script path). Used for Retina screen devices.
`iconSize` | `Point` | Size of the icon image in pixels.
`iconAnchor` | `Point` | The coordinates of the "tip" of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker's geographical location. Centered by default if size is specified, also can be set in CSS with negative margins.
`shadowUrl` | `String` | The URL to the icon shadow image. If not specified, no shadow image will be created.
`shadowRetinaUrl` | `String` | The URL to the retina sized version of the icon shadow image. If not specified, no shadow image will be created. Used for Retina screen devices.
`shadowSize` | `Point` | Size of the shadow image in pixels.
`shadowAnchor` | `Point` | The coordinates of the "tip" of the shadow (relative to its top left corner) (the same as `iconAnchor` if not specified).
`popupAnchor` | `Point` | The coordinates of the point from which popups will "open", relative to the icon anchor.
`className` | `String` | A custom class name to assign to both icon and shadow images. Empty by default.