⌁ Embedded & Hardware

Number Base, Float & Byte Converter

Convert between hex, decimal, binary and octal with two's complement and byte order, inspect IEEE 754 floats bit by bit, and convert byte lists between C, Python and C# syntax.

Two's complement IEEE 754 float/double Endianness Byte-list formats

Loading Number Base Converter…

What this page sends

  • Your input: Processed in this tab and not sent to a server.
  • Page load: Loading the page requests HTML, scripts and images from ByteKiln, fonts from Google Fonts, and sends Google Analytics page views, tool-usage events and catalog interactions (tool/category IDs, result status and whether a click followed search — never your input, output or search terms). Privacy & sharing

How the Number Base, Float & Byte Converter Works

Firmware work is full of the same few conversions: a register value in hex from a datasheet, the same value as a signed 16-bit integer from a sensor, a float received as four bytes over UART, a byte array that has to move from a Python test script into C. Each one is simple, and each has a trap — a sign bit misread, bytes in the wrong order, a float that is not the number you think it is. This converter keeps all the representations of a value in sync. Type in any base and the others update; choose a width and signedness and it shows the two's complement interpretation, the bytes in big- and little-endian order, the byte-swapped value, and a grid of bits you can click to toggle. The float view decodes IEEE 754 single and double precision into sign, exponent and mantissa, shows the exact decimal value that is stored, and explains subnormals, infinities and NaN payloads. The bytes view converts text to bytes in UTF-8, ASCII or Latin-1 and translates byte lists between the syntaxes of C, Python, C# and Base64.

Integers

Input is parsed into a BigInt, so any size works. Prefixes (0x, 0b, 0o) and separators (_, spaces, apostrophes) are accepted, and an invalid digit is named. For a fixed width, values are range-checked and the bit pattern is computed modulo 2^width, so negative numbers show their two's complement form.

Floats

Decimal input is rounded to the nearest float32 or float64 with a DataView, exactly as hardware does (round to nearest, ties to even). The stored value is then expanded to an exact decimal — every binary fraction has a finite decimal expansion — which shows immediately whether your literal was representable.

Byte order

Multi-byte values are shown in big-endian (network order, most significant byte first) and little-endian (what ARM, ESP32, AVR and x86 store in memory). The byte-swapped value is what you get when data is read with the wrong endianness.

Bytes and text

Text is encoded with TextEncoder for UTF-8, or byte-by-byte for ASCII and Latin-1 with a clear error for characters those encodings can't represent. Byte lists are decoded back to text with a strict UTF-8 decoder that flags invalid sequences.

Limitations

  • Floats are IEEE 754 binary32 and binary64 only — no half precision, bfloat16, fixed-point Q formats or 80-bit extended.
  • Bit fields and packed structs aren't laid out for you — convert one field at a time.
  • Byte-list conversion understands C, Python and C# array syntax; other syntaxes need tidying first.
  • Text encodings are UTF-8, ASCII and Latin-1 only; UTF-16 and Shift-JIS byte lists can't be decoded here.

FAQ

Short answers for the things developers usually ask before trusting a tool.

Is anything I type sent to a server?

No. Every conversion runs in your browser.

How does two's complement work here?

Pick a width (8, 16, 32 or 64 bits) and turn on "signed". The same bit pattern is then shown as both its signed and unsigned value: 0xFFFF at 16 bits is 65535 unsigned and -1 signed. Typing -1 in decimal shows its 16-bit pattern, 0xFFFF.

What happens if a number doesn't fit the selected width?

The converter tells you it overflowed, shows the valid range, and shows the truncated low bits — it never wraps silently. Choose "Any size" for arbitrary-precision integers.

Why does 0.1 show a long decimal in the float view?

Because 0.1 has no exact binary representation. The float view shows the exact value that is actually stored — for float32, 0.100000001490116119384765625 — which is the root of most floating-point surprises in firmware and finance code.

What are quiet and signaling NaNs?

Both have an all-ones exponent and a non-zero mantissa. The top mantissa bit distinguishes them: 1 is a quiet NaN, which propagates through arithmetic, and 0 is a signaling NaN, which can raise an exception. The remaining bits are the payload, which the float view also shows.

Which byte-list formats can I convert between?

Space-separated hex, plain hex, 0x12, 0x34, C initialisers {0x12, 0x34}, escaped strings \x12\x34, Python b'…' literals, C# new byte[] { … } and Base64. The input format is detected automatically.

Related tools

Useful follow-ups when one conversion usually turns into three more.

Want the background and worked examples? There's a longer write-up.

Read the Number Base Converter guide

Related guides