# toBase64

Description: toBase64 cheatcode documentation

Note: This document was authored using MDX

  Source: https://github.com/NomicFoundation/hardhat-website/tree/main/src/content/docs/docs/reference/cheatcodes/Utilities/to-base64.mdx

### Signature

```solidity
function toBase64(bytes calldata data) external pure returns (string memory);
function toBase64(string calldata data) external pure returns (string memory);
```

### Description

Encodes a `bytes` or `string` value to a base64 string.
