---
name: "SDL_BITSPERPIXEL"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_BITSPERPIXEL"
---

# SDL\_BITSPERPIXEL(3)

A macro to determine an SDL\_PixelFormat

## NAME

SDL\_BITSPERPIXEL - A macro to determine an  **SDL\_PixelFormat**

## HEADER FILE

Defined in SDL3/SDL\_pixels.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**#define SDL\_BITSPERPIXEL(format) .BI** *(SDL\_ISPIXELFORMAT\_FOURCC(format)***?***0***:***(((format)***\>\>***8)***&***0xFF))*

## DESCRIPTION

Note that this macro double-evaluates its parameter, so do not use expressions with side-effects here.

FourCC formats will report zero here, as it rarely makes sense to measure them per-pixel.

## RETURN VALUE

Returns the bits-per-pixel of **format** .

## THREAD SAFETY

It is safe to call this macro from any thread.

## AVAILABILITY

This macro is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_BYTESPERPIXEL**(3)](/SDL_BYTESPERPIXEL/3.md)
