> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Encode File To Base64 • AI Agent SDK

> encode_file_to_base64: Base64-encode a file.

# encode\_file\_to\_base64

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**agents**](../modules/agents) module.

Base64-encode a file.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def encode_file_to_base64(file_path: str) -> str
```

## Parameters

<ParamField query="file_path" type="str" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="str">
  The result of the operation.
</ResponseField>

## Uses

* `decode`
* `base64.b64encode`
* `f.read`

## Used By

* [`get_multimodal_message`](../functions/get_multimodal_message)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agents/agents.py#L38">
  `praisonaiagents/agents/agents.py` at line 38
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Code Agent" icon="code" href="/docs/features/codeagent" />

  <Card title="Code Feature" icon="terminal" href="/docs/features/code" />
</CardGroup>
