You are looking for the chr function.

You seem to be mixing decimal representations of integers and hex representations of integers, so it's not entirely clear what you need. Based on the description you gave, I think one of these snippets shows what you want.

>>> chr(0x65) == '\x65'
True


>>> hex(65)
'0x41'
>>> chr(65) == '\x41'
True

Note that this is quite different from a string containing an integer as hex. If that is what you want, use the hex builtin.

Answer from Mike Graham on Stack Overflow
🌐
VCalc
vcalc.com › wiki › integer-to-hex
Integer to Hex
January 28, 2019 - The Integer to Hexadecimal Calculator accepts an integer value and returns the given integer converted to hexadecimal.
Discussions

How do I convert an INT to HEX
Hello everyone, I am making a sort of jukebox and I need to convert an INT to HEX. I have a function called playSong that takes a number as string and sends a command to the MP3 player. void playSong(String Snumber){ int number = Snumber.toInt(); // function to convert int to hex goes here ... More on forum.arduino.cc
🌐 forum.arduino.cc
13
0
December 10, 2021
go - How can I convert from int to hex - Stack Overflow
I want to convert from int to hex in Golang. In strconv, there is a method that converts strings to hex. Is there a similar method to get a hex string from an int? More on stackoverflow.com
🌐 stackoverflow.com
Convert from int to hex | Qt Forum
Hello guys i have a problem in converting from int to hex. For example .. I have the number 203888026 which conversion is 0C27159A. I want this 0 in front of... More on forum.qt.io
🌐 forum.qt.io
June 27, 2020
c# - Convert integer to hexadecimal and back again - Stack Overflow
A fashionably belated response, but have you considered some sort of Integer shortening implementation? If the only goal is to make the user ID as short as possible, I'd be interested to know if there is any other apparent reason why you specifically require hexadecimal conversion - unless ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Baeldung
baeldung.com › home › java › java numbers › convert integer to hexadecimal in java
Convert Integer to Hexadecimal in Java | Baeldung
January 8, 2024 - The drawback of our implementation is that it only accepts positive integers greater than zero. The next method comes from the String class, the format() method. In this case, we use the %x specifier to get the hex format output.
🌐
Hexcalculator
hexcalculator.org › int-to-hex-in-csharp
Int to Hex in C#
May 29, 2026 - If you’re working with base conversions beyond C#, try our Decimal to Hex Converter for instant results. The simplest way to convert an int to hex in C# is by using the ToString() method with the format specifier "X".
🌐
Arduino Forum
forum.arduino.cc › projects › programming
How do I convert an INT to HEX - Programming - Arduino Forum
December 10, 2021 - I have a function called playSong that takes a number as string and sends a command to the MP3 player. void playSong(String Snumber){ int number = Snumber.toInt(); // function to convert int to hex goes here sendCommand(CMD_PLAY_W_INDEX, 0, HEX); } ...
🌐
RapidTables
rapidtables.com › convert › number › decimal-to-hex.html
Decimal to Hex Converter
Get the integer quotient for the next iteration. Get the remainder for the hex digit. Repeat the steps until the quotient is equal to 0.
Find elsewhere
🌐
Medium
medium.com › @whyamit404 › how-to-convert-an-int-to-a-hex-string-bf910545b3e8
How to Convert an Int to a Hex String? | by whyamit404 | Medium
February 8, 2025 - Now, here’s where things get interesting. You’re used to numbers in base 10 (decimal), where we have digits 0-9. But hexadecimal numbers use base 16. That means they go from 0 to 9, but after that, they use letters: A, B, C, D, E, F.
🌐
LeetCode
leetcode.com › problems › convert-a-number-to-hexadecimal
Convert a Number to Hexadecimal - LeetCode
Can you solve this real interview question? Convert a Number to Hexadecimal - Given a 32-bit integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement [https://en.wikipedia.org/wiki/Two's_complement] method is used.
🌐
Qt Forum
forum.qt.io › home › qt development › general and desktop › convert from int to hex
Convert from int to hex | Qt Forum
June 27, 2020 - QString QString::arg ( int a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const ... Welcome to the Qt Dev Net, and thank you for posting a solution!
🌐
Vultr Docs
docs.vultr.com › python › built-in › hex()
Python hex() - Convert Integer to Hexadecimal
November 25, 2024 - Define a positive integer. Use the hex() function to convert the integer to a hexadecimal string.
🌐
Hexcalculator
hexcalculator.org › signed-integer-to-hex
Signed Integer to Hex Converter Online
May 29, 2026 - This conversion is also foundational to operations like hex addition, logical bit-shifting, and binary masking. Type a signed number (like -128 or 1023) into the input field.
🌐
Cryptii
cryptii.com › pipes › integer-encoder
Integer encoder: Hex to 8, 16, 32-bit (un)signed integers - cryptii
In computer science, an integer is a data type that represents mathematical integers. They may be of different sizes and may or may not be allowed to contain negative values. In a computer they are commonly represented as a group of binary digits.
🌐
Codingace
codingace.net › conversion › int_to_hex.html
Int to Hex Calculator
An int to hex calculator changes a base ten integer into base sixteen form. This is useful in programming, electronics, networking, file analysis, and database work. Hexadecimal is compact. Each digit represents four binary bits. That means long binary values become shorter and easier to inspect.