Utvikling · verktøy

Binærkonverterer

Velg inndata- og utdata-base, skriv inn et heltall og konverter det lokalt.

Kjøres i nettleseren. Ingen opplasting.

Supports whole numbers in bases 2 through 36. Digits 0–9 and letters A–Z represent values.

Result
—

Om verktøyet

Binærkonverterer sem complicação.

Som en rask kontroll: desimaltallet 25 er binært 11001, oktalt 31 og heksadesimalt 19. Konverter signerte heltall mellom baser fra 2 til 36, også heksadesimalt til binært; brøker og prefikser som 0b eller 0x godtas ikke.

Veiledning

Slik bruker du Binærkonverterer

This page turns a whole number written in one base into the same number written in another base. You pick any base from 2 to 36 for the input and for the output, type your number, and press the button. Binary, octal, decimal and hexadecimal are all in the lists, and so is everything in between. It suits students learning how number systems work, programmers checking a value, and anyone who needs a quick answer without opening code. The work happens in your browser, so nothing you type is sent away. It handles whole numbers only, with an optional minus or plus sign.

Slik gjør du

  1. Open the From base list and choose the base your number is written in. Decimal is base 10, binary is base 2, and hexadecimal is base 16.
  2. Open the To base list and choose the base you want back. You can pick the same base twice, but that only repeats your number.
  3. Type your number into the box. Use only digits that exist in the base you chose, such as 0 and 1 for binary.
  4. Press Convert number. The answer appears in the Result line, written in capital letters when it contains letters.
  5. If you see an error, read the short message under the button. It names the base and tells you the digits were not valid for it.
  6. Press Clear to empty the box and the result, then start a new conversion.

Eksempler

Decimal 255 to binary

Du skriver inn
Fra
10
Til
2
Tall
255
Du får
Resultat
11111111

255 is one less than 256, so all eight binary places hold a 1. That gives eight ones in a row.

Kjørt med verktøyets egen kode.

Binary 11001 to decimal

Du skriver inn
Fra
2
Til
10
Tall
11001
Du får
Resultat
25

The places are worth 16, 8, 4, 2 and 1. The ones sit on 16, 8 and 1, and 16 plus 8 plus 1 is 25.

Kjørt med verktøyets egen kode.

Hexadecimal 1A3 to decimal and to binary

Du skriver inn
Fra
16
Tall
1A3
Til
10 or 2
Du får
Desimaltall
419
Binær
110100011

In hex, A stands for ten. So 1A3 means 1 times 256, plus 10 times 16, plus 3, which is 419. Run it again with To base set to 2 for the binary form.

Kjørt med verktøyets egen kode.

A negative number

Du skriver inn
Fra
10
Til
2
Tall
-42
Du får
Resultat
-101010

The sign is kept and put in front of the converted digits. The tool does not use a two's complement form.

Kjørt med verktøyets egen kode.

Base 36 uses every letter

Du skriver inn
Fra
36
Til
10
Tall
zz
Du får
Resultat
1295

In base 36, z is worth 35. So zz is 35 times 36 plus 35, which is 1295. Lower case letters are accepted.

Kjørt med verktøyets egen kode.

A space inside the number is rejected

Du skriver inn
Fra
2
Til
10
Tall
1010 1010
Du får
Feil
Use only valid digits for base 2.

Spaces are not valid digits, so a number grouped in bytes needs the spaces removed first.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Check a homework answer when you are learning how binary and decimal relate to each other.
  • Turn a hexadecimal value from a colour code or memory address into decimal to see its size.
  • Read a Unix style octal permission such as 755 as a decimal number.
  • Build a short code in base 36 by converting a long decimal id into fewer characters.
  • Verify a value you worked out by hand before you put it in a program.
  • Compare the same number in several bases while preparing a computer science lesson.

Begrensninger

  • Whole numbers only. A decimal point is rejected, so 3.5 gives an error.
  • Prefixes such as 0b or 0x are not accepted. Type only the digits.
  • Spaces between digits are not accepted. Underscores are removed before the conversion, so 1_000 works.
  • Input longer than 4,096 digits is refused. A leading plus or minus sign does not count towards the limit.
  • Negative numbers keep a minus sign. They are not shown as two's complement or with a fixed bit width.
  • The result is never padded with leading zeros, so you must add them yourself if you need 8 or 16 places.

Tips

  • To read a long binary number, split it into groups of four digits by hand. Each group matches one hex digit.
  • If you get an error, count the highest digit in your number. A 2 or higher cannot exist in binary, and a letter cannot exist in decimal.
  • Letters can be typed in either case. The answer always comes back in capitals.
  • Convert twice when you want to check yourself. Go from base 10 to base 2, then run the answer back to base 10.
  • Keep the signs you need. A leading plus is accepted and simply dropped from the answer.

Vanlige spørsmål

Sobre Binærkonverterer.

How do I convert binary to decimal?

Set From base to 2 and To base to 10, type the ones and zeros without spaces, and press Convert number. The tool adds up the place values for you. For example, 11001 gives 25.

How do I convert hexadecimal to binary?

Choose 16 for the From base and 2 for the To base, then type the hex digits. Letters A to F stand for ten to fifteen. Leave out any 0x at the start, because prefixes are rejected.

Which bases can I choose?

Any whole base from 2 up to 36 can be used for the input and for the output. Digits 0 to 9 come first, and then letters A to Z carry on the count, up to Z for 35.

Why does it say I used digits that are not valid?

Each base has a limited set of digits. Binary only has 0 and 1, and octal stops at 7. If your number holds a character outside that set, a space, or a dot, the tool names the base and stops.

Can it convert numbers with a decimal point or fraction?

No. Only whole numbers are supported, so a value like 10.5 shows an error. If you need a fractional part, convert the whole part here and work out the fraction separately.

How big a number can I enter?

The number can have up to 4,096 digits, not counting a leading sign. The arithmetic uses big integers, so even very long numbers stay exact instead of being rounded the way ordinary floating point numbers are.

What happens with negative numbers?

A leading minus sign is kept, and the rest is converted as normal. So -42 in decimal becomes -101010 in binary. The tool does not produce a two's complement bit pattern.

Does the result have leading zeros?

No. The answer is the shortest correct form, so decimal 5 shows as 101, not 00000101. Add zeros yourself when a system needs a fixed width, such as eight bits to make one byte.

Can I paste a number with spaces or underscores?

Underscores are removed before converting, so 1_000 is read as 1000. Spaces are not removed, so remove them first or you will see the invalid digit message.

Is my number sent to a server?

No. The page works out the answer inside your browser. Nothing you type is uploaded, so you can use it for private values without leaving a trace on a server.

Hvordan bruker du Binærkonverterer?

Velg inndata- og utdata-base, skriv inn et heltall og konverter det lokalt.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.