# Any way to convert an int or a float to hexadecimal?

**URL:** <https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [July 8, 2020, 8:59am UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153 "2020-07-08T08:59:05Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_532039351](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_532039351](https://forums.unrealengine.com/u/anonymous_user_532039351)\
**Post date:** [July 8, 2020, 8:59am UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/1 "2020-07-08T08:59:05Z")

</div>

Hello!  
Any way to convert an int or a float to hexadecimal? In blueprint of course 🙂

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 9:52am UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/2 "2020-07-08T09:52:07Z")

</div>

Yes there is. You just have to implement it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_532039351](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_532039351](https://forums.unrealengine.com/u/anonymous_user_532039351)\
**Post date:** [July 8, 2020, 12:36pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/3 "2020-07-08T12:36:54Z")

</div>

Could you please show me how?

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 1:49pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/4 "2020-07-08T13:49:20Z")

</div>

Here is an ugly direct implementation of the algorithm.

The function (input: integer; output: string):

 ![4.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/6/e/6e1b3d0e3338ecce9209717a60f980f5f822dacb.jpeg)](filedata/fetch?id=1785697&d=1594216431)

The macro \*GetHexDigit \*to map {1,2,…,15} → {1,2,…,F}:

 ![2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/7/07deadd334b20dffa983441bd50e409e23ebb0fe.jpeg)](filedata/fetch?id=1785695&d=1594215978)

Usage:

![3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/d/9d404c5b2f9c5442ef5f3e89d7cc9e7ad0bb1b3c.jpeg)](filedata/fetch?id=1785694&d=1594215978)

Result:

123456789 -\> 75BCD15

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 2:10pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/5 "2020-07-08T14:10:33Z")

</div>

Note that the previous solution doesn’t have input validation, so you still need to check for 0 and negative numbers.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_532039351](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_532039351](https://forums.unrealengine.com/u/anonymous_user_532039351)\
**Post date:** [July 8, 2020, 3:38pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/6 "2020-07-08T15:38:06Z")

</div>

Thanks! Maybe because the whole data on tick or maybe not, but I copied Your code and on print I see infinite lines every second.  
For example if I put in 15 for the integer input, the printed output comes out every frame like this:  
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF…  
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF…  
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF…  
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF…

I think maybe somewhere need to put in a doOnce, or maybe the while loop isn’t precise enough? Just thinking…

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 3:47pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/7 "2020-07-08T15:47:49Z")

</div>

It’s working just fine for me:

 ![1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/e/1/e1c9f3f28501451f8e984bf34b5981d04156ea33.jpeg)](filedata/fetch?id=1785732&d=1594223246)

![2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/6/e/6ecf7a5b55ecdd1e1fd472c2fff21a71a7add46a.jpeg)](filedata/fetch?id=1785731&d=1594223246)

How are you using it?

Can you show me your Int2Hex function?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_532039351](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_532039351](https://forums.unrealengine.com/u/anonymous_user_532039351)\
**Post date:** [July 8, 2020, 3:56pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/8 "2020-07-08T15:56:42Z")

</div>

![Screenshot_3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/1/a/1a9fa213eb6e3027e09476d250cf0a785d52fbd5.jpeg)  
 ![Screenshot_4.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/b/8b333c32cb3555b7a200189ab6a1ca161594daf6.jpeg)  
On second picture I have the flow from Tick (because the integer comes from tick), and I have an append function because The format needs to be [A"numbers"]

---

<div class="post-metadata">

**Author:** ![EvilCleric](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EvilCleric](https://forums.unrealengine.com/u/EvilCleric)\
**Post date:** [July 8, 2020, 4:58pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/9 "2020-07-08T16:58:29Z")

</div>

> [@anonymous\_user\_532039351](#):
>
> On second picture I have the flow from Tick (because the integer comes from tick), and I have an append function because The format needs to be [A"numbers"]

One little detail, the variables: **Result and Temp must be local**. Are yours local? If they are not, then, the result will always append to the previous one, resulting in an ever growing string.

So, make sure they are local, or set Result to empty at the beginning of the function.

---

<div class="post-metadata">

**Author:** ![Estape](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/estape/32/1007455_2.png) [@Estape](https://forums.unrealengine.com/u/Estape)\
**Post date:** [March 22, 2021, 6:40pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/10 "2021-03-22T18:40:25Z")

</div>

> [@EvilCleric](#):
>
> Here is an ugly direct implementation of the algorithm.
> 
> The function (input: integer; output: string):
> 
> ](filedata/fetch?id=1785697&d=1594216431)
> 
> The macro \*GetHexDigit \*to map {1,2,…,15} -\> {1,2,…,F}:
> 
> ](filedata/fetch?id=1785695&d=1594215978)
> 
> Usage:
> 
> ](filedata/fetch?id=1785694&d=1594215978)
> 
> Result:
> 
> 123456789 -\> 75BCD15

Works for me, thank you! 🆒

---

<div class="post-metadata">

**Author:** ![LemontreeSoftworks](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lemontreesoftworks/32/1097595_2.png) [@LemontreeSoftworks](https://forums.unrealengine.com/u/LemontreeSoftworks)\
**Post date:** [August 26, 2025, 1:33pm UTC](https://forums.unrealengine.com/t/any-way-to-convert-an-int-or-a-float-to-hexadecimal/147153/11 "2025-08-26T13:33:49Z")

</div>

A little late to the party…  
For such cases, I always have a C++ function library that fills in the missing functions in the Blueprints:

BlueprintHelper.h

```auto
#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "BlueprintHelper.generated.h"

UCLASS()
/// Functions to use from Blueprints
class UBlueprintHelper : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	UFUNCTION(BlueprintPure, Category = "Blueprint Helper")
	static FString IntToHexString(int Number, bool bUppercase = true)
	{
		return FString::Printf(bUppercase ? TEXT("%X") : TEXT("%x"), Number);
	}
};

```
