---
title: bg-color
summary: null
url: https://www.fastly.com/documentation/reference/io/bg-color
---


Sets the background color of the image.

The `bg-color` parameter sets the background color of an image to use when applying [padding](/reference/io/pad) or when replacing transparent pixels.


## Syntax

```text
bg-color={value}
```

`value` may be one of:

* **Hex RGB value**: Both 3- and 6-digit values are acceptable (e.g. `a22` or `cf23a5`).
* **Decimal RGB**: RGB values between 0 and 255. Comma-delimited (e.g. `255,0,0`).
* **Decimal RGB with alpha**| RGBA colors include an additional value for alpha (transparency), which ranges from 0 for fully transparent to 1 for fully opaque.

## Examples

Click the links to view the transformed image using a demo Fastly IO service.

|Example usage|Description|
|-----------|-------------|
|[`?bg-color=c5c5c5`](https://www.fastly.io/image.png?bg-color=cccccc)|Set background color to grey|
|[`?bg-color=000`](https://www.fastly.io/image.png?bg-color=000)|Set background color to black|
|[`?bg-color=0,255,0`](https://www.fastly.io/image.png?bg-color=0,255,0)|Set background color to green|
|[`?bg-color=0,255,0,0.5`](https://www.fastly.io/image.png?bg-color=0,255,0,0.5)|Set background color to green with 50% transparency|
