# base64

> This document is the Markdown version of [valibot.dev/api/base64/](https://valibot.dev/api/base64/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Creates a [Base64](https://en.wikipedia.org/wiki/Base64) validation action.

```ts
const Action = v.base64<TInput, TMessage>(message);
```

## Generics

- `TInput` `extends string`
- `TMessage` `extends ErrorMessage<Base64Issue<TInput>> | undefined`

## Parameters

- `message` `TMessage`

### Explanation

With `base64` you can validate the formatting of a string. If the input is not a Base64 string, you can use `message` to customize the error message.

## Returns

- `Action` `Base64Action<TInput, TMessage>`

## Examples

The following examples show how `base64` can be used.

### Base64 schema

Schema to validate a Base64 string.

```ts
const Base64Schema = v.pipe(v.string(), v.base64('The data is badly encoded.'));
```

## Related

The following APIs can be combined with `base64`.

### Schemas

[`any`](/api/any.md), [`custom`](/api/custom.md), [`string`](/api/string.md)

### Methods

[`pipe`](/api/pipe.md)

### Utils

[`isOfKind`](/api/isOfKind.md), [`isOfType`](/api/isOfType.md)
