**@tevm/contract** ∙ [README](../README.md) ∙ [API](../API.md)

***

[API](../API.md) > formatGwei

# Function: formatGwei()

> **formatGwei**(`wei`, `unit`?): `string`

Converts numerical wei to a string representation of gwei.

- Docs: https://viem.sh/docs/utilities/formatGwei

## Parameters

▪ **wei**: `bigint`

▪ **unit?**: `"wei"`

## Returns

## Example

```ts
import { formatGwei } from 'viem'

formatGwei(1000000000n)
// '1'
```

## Source

node\_modules/.pnpm/viem@2.4.0\_typescript@5.3.3\_zod@3.22.4/node\_modules/viem/\_types/utils/unit/formatGwei.d.ts:14

***
Generated using [typedoc-plugin-markdown](https://www.npmjs.com/package/typedoc-plugin-markdown) and [TypeDoc](https://typedoc.org/)
