web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Hexadecimal to Decimal
Power Apps
Unanswered

Hexadecimal to Decimal

(0) ShareShare
ReportReport
Posted on by 308

Hi Community!

I'm very surprised that there isn't a HEX to INT function in PowerApps. Anybody got this solved?

 

Lot Thanks

Categories:
I have the same question (0)
  • Masum172 Profile Picture
    on at

    Maybe this is worth a try..

     

    Concat(
    ForAll(
    Sequence(RoundUp(Log(Value(<yourvalue>)+1,16),0),RoundUp(Log(Value(<yourvalue>)+1,16),0),-1),
    {result:Last(FirstN(["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],(Mod(RoundDown(Value(<yourvalue>)/Power(16,ThisRecord.Value-1),0),16)+1))).Value}),
    result&"")

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Edit

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Edit

  • Ismael_Novo Profile Picture
    308 on at

    Thank you guys, finally I create my own approach but the int value is outside PowerApps limits!!! This number "2d074a170afd6394" can't be saved on a normal int. How I can handle big numbers? 

     

    I put here my solution because for me is easier to read. One table with power 16s and after that I make a SUM of the result table:

     

    ClearCollect(auxCol;{}) ;; Remove(auxCol;First(auxCol)) ;;
    
    ForAll(Split(HEX;"") As TABLE; Collect(auxCol;
     Value(
     Switch(TABLE.Result;
     "0";0;"1";1;"2";2;"3";3;"4";4;"5";5;"6";6;"7";7;"8";8;
     "9";9;"a";10;"b";11;"c";12;"d";13;"e";14;"f";15
     ) 
     ) * Power(16;CountRows(Split(HEX;"")) - CountRows(auxCol) - 1)
     )
    )

     

  • TheRobRush Profile Picture
    11,128 Moderator on at

    I did a test as well, mine will properly convert up to 13 digit hex codes, after that it gets off. Definitely seems to be a limitation in powerapps. here was my code 

     

    ClearCollect(HexSplit, 
    
    ForAll(Upper(Split(TextInput1.Text,"")) As HexVals,
     {Hex:HexVals.Result,
     Dec:Switch(HexVals.Result,
     "0", 0, "1", 1, "2", 2, "3", 3, "4", 4, "5", 5,
     "6", 6, "7", 7, "8", 8, "9", 9, "A", 10,
     "B", 11, "C", 12, "D", 13, "E", 14, "F", 15)}));
    
    
    Set(HexFinal, 
    Sum(
     ForAll(Sequence(CountRows(HexSplit),0,1) As stepCount, 
     {Formula:Text(Last(FirstN(HexSplit, CountRows(HexSplit)-stepCount.Value)).Dec)&"*16 to the "&Text(stepCount.Value),
     ValMid:Sum(Last(FirstN(HexSplit, CountRows(HexSplit)-stepCount.Value)).Dec)*Power(16,stepCount.Value)}),ValMid)) 

     

     

    even added a text box and put value(correct answer) in it and it changed it to the same value see below

    TheRobRush_0-1676775859453.png

     

    what I find most perplexing about it is both the CORRECT answer and the ANSWER given are 19 numbers long,  AND the given number is LARGER than the correct answer, so it's not like its hit a value cap and just stopped at the capped number.

     

    @timl  @WarrenBelz  Do either of you guys see/know a way around this issue?

     

     

    **Edit extra column in my set () portion of the formula was just me makign sure in a collect prior, that every step was giving right formula, ignore it

  • TheRobRush Profile Picture
    11,128 Moderator on at

    @Ismael_Novo  also found this function

    Hex2Dec(Put hex value here)

     

    It stops working after 10 digits though, 9 if every digit is F

  • Ismael_Novo Profile Picture
    308 on at

    We need longer HEX numbers and conversions. The Google Contacts API returns the length I mentioned before but to generate a link to a contact you access it using that ID transformed in base 10.

    https://contacts.google.com/person/c36472450167811551

    It's 17 digits int plus a "c"! I am quite surprised with this limitation. We are talking about the fact that there is no long type in powerapps and I'm sure we will need it more often in the future.

  • TheRobRush Profile Picture
    11,128 Moderator on at

    So after a lot of testing trying to get the correct number to at least display via splits, lefts rights etc I can pretty confidently say that powerapps cannot at this time display the number 32446435193372813204

     

    The reason for this is the number values powerapps can safely display seem to be tied to the same range in JavaScript. See Here. This caps out at 9007199254740992 (or 9007199254740991 depending on how you look at it) It is IEEE 754 64-Bit Format After that point numbers will no longer necessarily display properly, and in JavaScript to handle these numbers you would have to change from a Number to a BigInt. PowerApps, to my knowledge so far, has no comparable function.

     

    TheRobRush_0-1676816721233.png

    Any number after 9007199254740992 may or may not display properly.

     

  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @TheRobRush 

    Thanks for this thorough explanation - you're completely spot on.

    This is what Microsoft said when I asked a similar question a while ago.

    https://powerusers.microsoft.com/t5/Building-Power-Apps/What-s-the-maximum-value-you-can-store-in-a-number-field/td-p/31418

     

    I've not tried this but it might be worth seeing if it is possible to do this conversion with a PCF control. The PCF control would accept a hex input as a string and output the result as a string. Internally, it would carry out the conversion using the bigint datatype.

    Alternatively, we could write an Azure function that returns a string result, and we would call this function with a custom connector. Unfortunately, this would require a premium license.

    Also, it might be worth exploring if there's some trick we could use in Flow to do this. Perhaps one of the Flow experts could comment - @Pstork1??

  • dennis51 Profile Picture
    5 on at

    This component doesn't seem to have the limitation of 9 or 10 digits if that helps:

    //Component to Convert large hex numbers to decimals
    //Property: DecimalNumber with Parameter HexNumber (text)
    //This code goes in the DecimalNumber property of the component (e.g. cmpHexToDecimal property DecimalNumber)
    //This component function is called with cmpHexToDecimal(txtHexNnumber), example: cmpHexToDecimal_1.DecimalNumber(TextInput1.Text)
    //non hex numbers are ignored

    With({tbx1: AddColumns(Split(HexNumber,""),"dec1", 0)}, //add column to hex input table to calculate decimal table
    With({tbx2: ForAll( //add rownumber to the table
    Sequence(CountRows(tbx1)),
    Patch(
    Last(FirstN(tbx1, Value)),
    {RowNumber: Value}
    ))},
    With({tbx3: ForAll(tbx2, //calculate decimal value for each position
    If(Lower(Value)="f", {dec1: 15*Power(16,CountRows(tbx2)-RowNumber)}
    ,If(Lower(Value)="e", {dec1: 14*Power(16,CountRows(tbx2)-RowNumber)}
    ,If(Lower(Value)="d", {dec1: 13*Power(16,CountRows(tbx2)-RowNumber)}
    ,If(Lower(Value)="c", {dec1: 12*Power(16,CountRows(tbx2)-RowNumber)}
    ,If(Lower(Value)="b", {dec1: 11*Power(16,CountRows(tbx2)-RowNumber)}
    ,If(Lower(Value)="a", {dec1: 10*Power(16,CountRows(tbx2)-RowNumber)}
    , If(IsNumeric(Value), {dec1: Value*Power(16,CountRows(tbx2)-RowNumber)}

    ))) )))))
    }, Sum(tbx3,dec1) // the number to get the decimal total
    )
    )
    )

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard