Text.EncodeToBase64
-------------------

Encode a base64 string.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Text](component_Text.md) | [3.0](newinversion30.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Text.EncodeToBase64"; Text { ; Encoding } ) 

**MBS**( **"Text.EncodeToBase64";** /\* Encode a base64 string. \*/  
**$Text**; /\* The text to process.e.g. "Hello World" \*/   
**$Encoding**) /\* Optional; The text encoding for text parameter.   
Default is native.e.g. "UTF-8" \*/ 

(old name: String.EncodeToBase64)

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | The text to process. | "Hello World" |  |
| Encoding | The text encoding for text parameter.    Default is native.   Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the [FAQ](https://www.monkeybreadsoftware.com/filemaker/faq.shtml). | "UTF-8" | Optional |

### Result

Returns encoded text.

### Description

Encode a base64 string.   
Please check what text encoding you want to use. Especially what the software processing the base64 string expects.  
### Examples

Encode Base64 as UTF-8:

 MBS ( "Text.EncodeToBase64"; "Hello World"; "utf8" )  
<small>  
Example result: "SGVsbG8gV29ybGQ="</small>### See also

- [Hash.SHA256.HMAC](HashSHA256HMAC.md)
- [RSA.Sign](RSASign.md)
- [Text.DecodeFromBase64](TextDecodeFromBase64.md)
- [Text.EncodeBytesToBase64](TextEncodeBytesToBase64.md)
- [Text.EncodeHexToBase64](TextEncodeHexToBase64.md)
- [Text.EncodeToBase64URL](TextEncodeToBase64URL.md)
- [Text.EncodeToBytes](TextEncodeToBytes.md)
- [TOTP.EncodeToBase32](TOTPEncodeToBase32.md)

### Example Databases

- [Text functions/Encode Bytes as Base64](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Text%20functions/Encode%20Bytes%20as%20Base64.shtml#1292FieldAnchor_)
- [Text functions/Text Styles](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Text%20functions/Text%20Styles.shtml#5ScriptAnchor_)

### Blog Entries

- [Comparing Base Elements Plugin to MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2017-10-24/Comparing_Base_Elements_Plugin/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.0pr3](https://www.mbsplugins.de/archive/2012-10-19/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 18th August 2014 , last changed 11st December 2016

  
[Text.EncodeHexToBase64](TextEncodeHexToBase64.md) - [Text.EncodeToBase64URL](TextEncodeToBase64URL.md)

[HTML Version](TextEncodeToBase64.shtml)