Removing a programming-language prefix before explicit-base conversion
The integer base converter takes the source base from a separate field, so it expects bare digits such as FF. A programming-language prefix such as 0x is not part of the digit string and is rejected.
Notation and digits are different things
A literal such as 0xFF in many programming languages carries two pieces of information: the digits FF and a prefix saying they are hexadecimal. The integer base converter separates the two. The base goes in its own field, here 16, and the value field holds only digits. With source base 16 and target base 10, the digit string FF converts to 255. The characters 0xFF are rejected because x is not a hexadecimal digit. The base selector already supplies what the prefix would have said in another syntax, so repeating it inside the value would be a second, conflicting description of the same thing.
How the conversion works
The converter parses a signed digit string using repeated multiply-and-add in arbitrary-precision integers, then formats the result by repeated division, for any base from 2 to 36. For FF in base 16, it starts at 0, takes the first F (15), then computes 15 × 16 + 15 = 255. The digit alphabet is 0 to 9 followed by A to Z, where A stands for 10 and Z for 35. A digit is valid only if its value is below the base. That rule explains the rejection of x, whose value would be 33, which is not below 16. The digit 0 in front of it is fine, but the whole string fails at the x.
Reading the error
When the value contains a character outside the selected digit alphabet, the converter reports that a digit is invalid and does not guess what was meant. This is deliberate. A guess could silently produce a wrong number, and a rejected input is easier to fix than a wrong output. The fix here is simple: remove the 0x and keep FF. The message describes the characters of the value, not the way the number was written elsewhere, so it will not mention programming languages. If you see it, compare each character of the value with the digits allowed in the chosen base.
Other prefixes in common use
Other prefixes work the same way. Binary literals may start with 0b, as in 0b1010, octal literals with 0o, as in 0o17, and hexadecimal literals with 0x. Some older conventions use a leading 0 alone for octal, which means 017 is octal 15 in those languages but is the digits 0, 1 and 7 for this converter. With source base 10 the converter reads 017 as 17, and with source base 8 it reads it as 15 in decimal. The base field decides the meaning, and the converter never infers a base from the way the digits are written. Remove any prefix and select the base explicitly.
When removing a prefix changes meaning
Not every leading letter is a prefix. In base 16, the string 0B1010 is a valid hexadecimal number, because B is a hex digit. The converter accepts it and returns 725008 in decimal, which is 11 × 65,536 + 1 × 4,096 + 1 × 16. If that string was a binary literal written as 0b1010 in another language, the intended value was 10, and the converter would give the wrong answer without any error message. This is why prefix removal is safe only when you know the source notation. An arbitrary leading letter can belong to the digit string in a larger base, and the tool does not parse expressions or guess the language that produced them.
FF, 1A and Z once the prefix is gone
Once the prefix is gone, the conversions are plain. FF in base 16 gives 255 in base 10, and 377 in base 8, since 3 × 64 + 7 × 8 + 7 = 255. In base 2 it gives 11111111, eight ones. The value 1A in base 16 is 1 × 16 + 10 = 26 in decimal. The single digit Z in base 36 is 35. Larger values work the same way, because the converter uses arbitrary-precision integers and does not lose digits on long inputs. Each of these entries leaves out any prefix and sets the source base in its own field.
Negative numbers and signs
The converter accepts a signed digit string, so a minus sign in front of the digits is handled as a sign and not as a digit. For example, a negative hexadecimal value is written as a minus followed by the digits, with no prefix between them. Placing the prefix after the sign, as in -0xFF, fails for the same reason as 0xFF does. Whether a program writes negative numbers this way or uses a two's complement representation is a different matter, and the converter does not interpret bit patterns. It converts the signed integer you type from one base to another.
Keeping the original source available
Before editing a literal, keep a copy of the original text. If the source notation is understood, removing 0x is routine. If it is not, the leading characters could carry meaning that you would lose. Writing down the language or tool that produced the string tells you which prefix rules applied. After conversion, compare the result with an independent check, for example by converting back to the original base and confirming that you get the digits you started with. A round trip from base 16 to base 10 and back to base 16 should return FF. Watch for letter and digit lookalikes in copied text, such as the letter O for zero or a lowercase l for one, which are invalid in most bases and produce the same kind of rejection as a prefix does.
What the converter does not do
This tool converts one integer from one base to another. It does not parse complete expressions, evaluate code, recognize programming languages, or accept fractions and exponents. It does not decide which base a string is written in. Those limits keep its behavior predictable: a value is either a valid digit string for the chosen base or it is rejected. When you meet an error, check the base field first, then the characters, and remove any notation that is not a digit in that base. Spaces, underscores used as digit separators in some languages, and trailing type suffixes are not digits either, so strip them before converting. Keep the cleaned string next to the original in your notes, along with the base you selected, so the conversion can be repeated and checked by someone else.
Reproduce the checks
Unprefixed hexadecimal digits
Open the Integer Base Converter and enter:
- Value
FF- Source base
16- Target base
10
Expected output:
Value
255The source base is explicit in the separate field.
Literal prefix rejected
Open the Integer Base Converter and enter:
- Value
0xFF- Source base
16- Target base
10
Expected rejection:
digit is invalidThe x does not belong to the selected digit alphabet.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08