Decimal to Hex
Convert a whole decimal integer to hexadecimal. This page starts with 255 in base 10 and hexadecimal output FF. Conversion steps show division by 16 with remainders written as 0–9 and A–F. It accepts a leading minus sign and retains exact large values; it does not encode a fractional number or a floating-point register.
Hexadecimal255 decimal · 8 bits · fits u8
- To base
Conversion steps
- Read 255 in base 10 by place value:
- 2 = 2; 2 × 10^2 = 200
- 5 = 5; 5 × 10^1 = 50
- 5 = 5; 5 × 10^0 = 5
- Add those terms: 255 in decimal.
- 255 ÷ 16 = 15, remainder 15 (F).
- 15 ÷ 16 = 0, remainder 15 (F).
- Read the remainder digits from last to first: FF in base 16.
Arbitrary precision, not doubles. Converting a 64-bit hash in a calculator built on JavaScript numbers silently loses the low bits past 253: 9007199254740993 comes back as …992, with nothing on screen to say so. This uses BigInt throughout, so a 128-bit value round-trips exactly. .
Common questions
- Why do other base converters get large numbers wrong?
- Because they convert through a JavaScript number, which is a 64-bit float and can only represent integers exactly up to 2^53 − 1. Paste a 64-bit hash into one and the low digits come back changed, with no warning. The tool has silently rounded. This converter uses BigInt end to end, so 2^53 and 2^53 + 1 are distinguishable and a 128-bit value survives the round trip intact.
- Which bases are supported?
- Every base from 2 to 36, using the digits 0–9 then A–Z. Binary, octal, decimal and hexadecimal are shown together on every conversion since those are what people usually want side by side; base 36 is included because it is the most compact base expressible in alphanumerics, which makes it useful for short identifiers.
- Can I paste a value with a 0x or 0b prefix?
- Yes. A leading 0x, 0b or 0o sets the base automatically, so you can paste straight from source code or a debugger. Underscores and spaces are accepted as digit separators and ignored, so 0xDEAD_BEEF and 1010 1010 both parse, and case does not matter.
- What does the bit width tell me?
- How many bits the value actually needs, and therefore which fixed-width integer types it fits. The tool reports whether the number fits u8, i8, u16, i16, u32, i32, u64, i64 or u128, which is the question you usually have when converting: not what the hex is, but whether it will fit in the column or the register you are about to put it in.
- How are negative numbers handled?
- A leading minus sign is accepted and the magnitude is converted, so −255 becomes −FF in hex. That is mathematical base conversion rather than two's-complement encoding, which is a different operation and depends on a chosen width. The tool notes the two's-complement representation separately where a width is implied, so the two are never confused.
- Is there a limit on how large a number I can convert?
- Only your device's memory. Numbers with hundreds of digits convert exactly and quickly. There is no imposed cap because nothing is being sent anywhere and no server is paying for the computation.
- Can I convert binary to decimal, decimal to binary, hex to decimal and decimal to hex?
- Yes. Set From base to 2 for binary, 10 for decimal or 16 for hex, and choose the output in To base. Each of these four common directions has a preset page with a worked example. Custom input and output bases from 2 to 36 also work; the complete value is retained in the result table even when the large display is shortened.
- Does it show conversion steps, a formula and worked examples?
- Conversion steps expand the canonical input digits by place value, then divide the decimal magnitude repeatedly by the output base. For example 1011 binary is 1×2^3 + 0×2^2 + 1×2^1 + 1×2^0 = 11 decimal, or B in hex. Detailed working is limited to 64 canonical input digits and 128 output digits; larger integers still convert completely without a step-by-step trace.
- Does it convert fractional numbers, IEEE 754, BCD or incoming signed bit patterns?
- The converter accepts whole integers, including a leading minus sign. It does not convert fractional digits, floating-point encodings, binary-coded decimal, Gray code or arbitrary incoming two’s-complement patterns. An unmarked 11111111 binary input is the positive integer 255. Negative inputs have separate two’s-complement output rows for fitting signed widths; this does not turn the input into a signed bit-pattern decoder. IEEE 754 Converter inspects binary32 and binary64 decimal values and bit patterns, including their rounding error; it is the preferred tool for floating-point representation.
- Are fixed-width bytes and base-conversion tables available?
- The unsigned-byte reference table lists 0 through 255 in decimal, eight-bit binary, octal and hex. General positive output uses canonical digits without forced left-padding. The negative-value rows show fitting signed widths from 8 to 128 bits. A custom fixed-width positive encoder or arbitrary-width signed decoder is not supplied.
- Can I paste numbers with separators or a decimal comma?
- Spaces, underscores and apostrophes can group digits. Commas are accepted only as unambiguous groups of three; 1,5 is refused instead of silently becoming 15. Source-code type suffixes, invisible characters and conflicting prefixes are named. A valid 0x, 0b or 0o prefix identifies its own input base.
- Can it decode text, IP addresses, colour codes or files?
- It converts an integer rather than a file or structured value. Binary to Text and Text to Hex decode UTF-8 bytes. It does not generate software, circuit diagrams, file conversions, APIs, IP layouts or colour-channel formats. Identical-looking digits can mean different things in those formats. Hex to RGB converts hexadecimal colours into separate decimal red, green and blue channels.
- What does a preset page save?
- Presets open the stated source base, output base and example. Only controls you explicitly change update their remembered keys; visiting a preset or changing an unrelated control does not replace prior choices.
Exact. Every conversion runs on arbitrary-precision integers, so values of any size round-trip without losing a digit.