# Help converting to an Int

**URL:** <https://forum.algorand.co/t/help-converting-to-an-int/6274>\
**Category:** General\
**Tags:** teal, smart-contracts\
**Created:** [March 15, 2022, 4:15pm UTC](https://forum.algorand.co/t/help-converting-to-an-int/6274 "2022-03-15T16:15:38Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [March 15, 2022, 4:43pm UTC](https://forum.algorand.co/t/help-converting-to-an-int/6274/2 "2022-03-15T16:43:52Z")

</div>

You need to write a subroutine for that.  
You can look at:

> **[GitHub - algorand/pyteal-utils](https://github.com/algorand/pyteal-utils)**
>
> Contribute to algorand/pyteal-utils development by creating an account on GitHub.

That being said, in the specific case where the integer is an application argument, I would strongly recommend you to instead encode the integer following:  
[Store an int in key local variable - #2 by fabrice](https://forum.algorand.co/t/store-an-int-in-key-local-variable/5173/2) (in smart contract)  
[Save price/amount in contract - sdk js - #2 by fabrice](https://forum.algorand.co/t/save-price-amount-in-contract-sdk-js/5893/2) (for encoding in the SDK)

This is much more compact and much less error-prone.  
Decimal strings representing integers (like “123456”) should only be used for human-readable values (e.g., in `Log`) or in cases where you really have no choice of encoding (e.g., if you get a signed decimal integer).

---

_[View the full topic](https://forum.algorand.co/t/help-converting-to-an-int/6274)._
