Unsigned Integer to Signed Converter

Converts a list of unsigned integers (one per line) into their two's-complement signed equivalents at a chosen bit width (8, 16, or 32): reinterprets each value's bit pattern as signed at that width. Values outside the unsigned range for the chosen width are rejected. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

This tool reverses the signed/unsigned reinterpretation performed by its companion tool: given an unsigned integer and a bit width, it returns the two's-complement signed value with the identical underlying bit pattern.

It's useful whenever a value arrives as unsigned (from a file format, protocol, or API) but needs to be understood or used as a signed number.

What Is Unsigned Integer to Signed Converter?

A converter that takes a list of unsigned integers, one per line, plus a chosen bit width (8, 16, or 32), and outputs each value's signed two's-complement equivalent at that width.

It models exactly what happens when an unsigned variable's raw bits are read as a signed type in a language like C.

How Unsigned Integer to Signed Converter Works

Each integer is first checked against the valid unsigned range for the chosen bit width; values outside that range are rejected.

Values below the halfway point of the range (2^(width-1)) are left unchanged, since their high bit is 0 in both interpretations.

Values at or above that threshold have 2 raised to the bit width subtracted, producing the equivalent negative signed value.

When To Use Unsigned Integer to Signed Converter

Use it when a binary file format, protocol, or API gives you an unsigned value that actually represents a signed quantity.

It's also useful for teaching or verifying how two's-complement representation relates unsigned and signed interpretations of the same bits.

Features

Advantages

  • Directly models real hardware/language behavior for the three most common integer widths.
  • Validates the input range up front, catching values that couldn't exist at the chosen width.

Limitations

  • Only supports 8, 16, and 32-bit widths; other widths (like 64-bit) aren't available.
  • Operates on the mathematical value only; it doesn't model any particular programming language's specific overflow or casting syntax.

Examples

High unsigned 8-bit value

Input

255, width: 8

Output

-1

Low value (unchanged)

Input

100, width: 8

Output

100

Best Practices & Notes

Best Practices

  • Match the bit width to the actual size of the integer type in your data source to get a meaningful signed result.

Developer Notes

Implemented with plain arithmetic (`n - 2 ** bitWidth` when `n` is at or above the signed threshold) rather than actual bitwise operators, since JavaScript's bitwise operators are limited to 32-bit signed semantics and wouldn't generalize cleanly to 8/16-bit widths.

Unsigned Integer to Signed Converter Use Cases

  • Converting an unsigned value from a file format or protocol into its intended signed meaning
  • Understanding how a large unsigned number's bit pattern appears when read as signed
  • Checking two's-complement arithmetic by hand for 8, 16, or 32-bit values

Common Mistakes

  • Picking the wrong bit width for the data source, which changes the resulting signed value entirely.
  • Entering a value outside the valid unsigned range for the chosen width, which is rejected rather than silently wrapped.

Tips

  • Use the companion Signed Integer to Unsigned Converter to reverse the conversion and confirm round-tripping.

References

Frequently Asked Questions