# System.Encrypt(Text) Method
> Version: _Available or changed with runtime version 1.0._
Takes a string as input and returns the encrypted value of the string.
## Syntax
```al
EncryptedString :=   System.Encrypt(PlainTextString: Text)
```
> NOTE
> This method can be invoked without specifying the data type name.
## Parameters
PlainTextString
Type: ../text/text-data-type
The input string that will be encrypted. The input string cannot exceed a length of 215 plain characters. If the input string includes special characters the length is even more reduced.
## Return Value
EncryptedString
Type: ../text/text-data-type
The output string that is encrypted.
## Remarks
If encryption is not enabled or the encryption key is not found, the following error will be displayed: An encryption key is required to complete the request.
## Example
```al
var
    Text000: Text;
begin
    Text000 := 'ABC123';
    Message('Value: ' + Text000);
    Text000 := Encrypt(Text000);
    Message('Value: ' + Text000);
end;
```
This code example takes the string value ABC123 and outputs the encrypted value of the string. The encrypted value will vary from system to system due to differences in the encryption key.
## Related information
system-data-type
Get Started with AL<../../devenv-get-started>
Developing Extensions<../../devenv-dev-overview>

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-encrypt-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/system/system-encrypt-method/
