<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "CKToolJS",
  "identifier" : "/documentation/CKToolJS/CKToolDatabaseModule/toBase64String",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "CKTool JS"
    ],
    "preciseIdentifier" : "clm/CKToolDatabaseModule/toBase64String"
  },
  "title" : "toBase64String"
}
-->

# toBase64String

Converts a regular string to a `Base64String`.

```
static Base64String toBase64String();
```

## Parameters

`value`

A string value to convert or validate.

## Return Value

If the value passes validation, this function returns a `Base64String`; otherwise it throws `ValueNotBase64StringError`. A string passes validation if it is a base 64 string.

## Discussion

In TypeScript, `Base64String` is a branded string type. In JavaScript, it’s a string.

```javascript
import { toBase64String } from "@apple/cktool.database";
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)