---
title: base64
description: Creates a Base64 validation action.
source: /actions/base64/base64.ts
contributors:
  - fabian-hiller
  - EltonLobo07
  - morinokami
---

import { ApiList, Property } from '~/components';
import { properties } from './properties';

# base64

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

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

## Generics

- `TInput` <Property {...properties.TInput} />
- `TMessage` <Property {...properties.TMessage} />

## Parameters

- `message` <Property {...properties.message} />

### 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` <Property {...properties.Action} />

## 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

<ApiList items={['any', 'custom', 'string']} />

### Methods

<ApiList items={['pipe']} />

### Utils

<ApiList items={['isOfKind', 'isOfType']} />
