> For the complete documentation index, see [llms.txt](https://docs.novabloq.com/web3-metamask/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.novabloq.com/web3-metamask/elements-details/web3-utils/to-wei.md).

# To Wei

WEI is often used when interacting with smart contracts.

{% hint style="danger" %}
Avoid doing the WEI calculation directly in the input fields, doing so may result in errors because of big numbers. Use To Wei or From Wei action instead.
{% endhint %}

## &#x20;<mark style="background-color:blue;">Parameters</mark>&#x20;

<table><thead><tr><th width="178.33333333333331">Parameter name</th><th width="105">Type</th><th width="470.6666666666667">Description</th></tr></thead><tbody><tr><td>Number</td><td>Number</td><td>The amount to be converted</td></tr><tr><td>Decimals</td><td>Number</td><td>Optional.<br>Token decimals. Useful for correct calculation when the token has different decimals than the standard 18</td></tr></tbody></table>

## &#x20;<mark style="background-color:blue;">States (result)</mark>&#x20;

<table><thead><tr><th width="147.33333333333331">State name</th><th width="89">Type</th><th>Description</th></tr></thead><tbody><tr><td>To WEI result</td><td>Text</td><td>Result of the conversion. Note that the result isn't instantly available, so when using the result in the same workflow where the action is run, add a small pause (200 ms) between this action and the next one where the result is used </td></tr></tbody></table>

Demo for how to use To Wei and From Wei features:\
<https://web3-demo.bubbleapps.io/version-test/wei>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.novabloq.com/web3-metamask/elements-details/web3-utils/to-wei.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
