Search for a tool
Base N Convert

Tool to write numbers in base N (change of basis / convert). In numeral systems, a base (radix) is the value of successive powers when writing a number.

Results

Base N Convert -

Tag(s) : Arithmetics

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Base N Convert' tool for free! Thank you!

Base N Convert

Base Conversion Calculator (advanced)










Base 10 to Base N Conversion



Answers to Questions (FAQ)

What is a base in arithmetic? (Definition)

The base (or radix) is the number of distinct digits needed to write the numbers (in a positional numeral system).

Example: In decimal base, the base used by default to write numbers, 10 digits are used: from 0 to 9, so it is a writing in base 10.

How to convert from a base to another?

A number $ N $ in base/radix $ b $ can be written with an addition of powers in this base $ b $.

Example: The number $ N = 123_{(10)} $ (base 10) verifies the equality $$ N = 789 = 7 \times 100 + 8 \times 10 + 9 \times 1 = 7 \times 10^2 + 8 \times 10^1 + 9 \times 10^0 $$

$ N= $$ c2 $$ c1 $$ c0 $
$ 789 $$ 7 $$ 8 $$ 9 $

Take a number $ N $ made of $ n $ digits $ { c_{n-1}, c_{n-2}, \cdots, c_2, c_1, c_0 } $ in base $ b $, it can be written it as a polynomial:

$$ N_{(b)} = \{ c_{n-1}, \cdots, c_1, c_0 \}_{(b)} = c_{n-1} \times b^{n-1} + \cdots + c_1 \times b^1 + c_0 \times b^0 $$

To compute a base change, base $ 10 $ is the reference, or an intermediate step.

Example: To change from base $ 3 $ to base $ 7 $, calculate base $ 3 $ to base $ 10 $, then from base $ 10 $ to base $ 7 $.

What are default symbols?

A number in base/radix 10 is written with the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 are used. For other bases, it is common to use letters, more precisely the following characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ (Beware to lowercase and uppercase from base 37) in order to write numbers up to base 62.

How to convert from base 10 to base n?

Use the following algorithm to convert/encode from base $ 10 $ to base $ n $:

$$ q_0=n; i=0; \mbox{ while } q_i > 0 \mbox{ do } (r_i = q_i \mbox{ mod } b; q_{i+1}= q_i \mbox{ div } b ; i = i+1 ) $$

The converted number is composed of digits $ r_{i=0 \cdots n-1} $ (with $ r_0 $ the digit of the units).

Example: $ N = 123_{(10)} $ (base 10) is converted to base $ 7 $:

$$ q_0 = 123 \\ r_0 = 123 \mbox{ mod } 7 = 4 \;\;\; q_1 = 123 \mbox{ div } 7 = 17 \\ r_1 = 17 \mbox{ mod } 7 = 3 \;\;\; q_1 = 17 \mbox{ div } 7 = 2 \\ r_2 = 2 \mbox{ mod } 7 = 2 \;\;\; q_2 = 2 \mbox{ div } 7 = 0 \\ 123_{(10)} = 234_{(7)} $$

How to convert from base n to base 10?

To convert/decode a number $ N_1 $ written in base $ b $ in a number $ N_2 $ written in base $ 10 $, use the fact that $ N_1 $ is made of $ n $ digits $ { c_{n-1}, c_{n-2}, \cdots, c_1, c_0 } $ and apply the following algorithm:

$$ N_2 = c_{n-1} ; \mbox{ for } ( i=n-2 \mbox{ to } 1 ) \mbox{ do } N_2=N_2 \times b+c_i $$

The number $ N_2 $ is written in base $ 10 $.

The algorithm is equivalent to the calculation $$ (( c_{n-1} \times b + c_{n-2} ) \times b + c_{n-3} ) \cdots ) \times b + c_0 $$

Example: Take the number $ 123_{(7)} $ (in base $ 7 $), and apply the conversion algorithm:

$$ 123 = \{1,2,3\} \\ N = 1 \\ N = 1*7+2 = 9 \\ N = 9*7+3 = 66 \\ N = 123_{(7)} = 66_{(10)} $$

So $ 123_{(7)} $ is equal to $ 66_{(10)} $ in base $ 10 $.

What are usual bases?

— base 2 (binary system - base2) in informatics

— base 3 (trinary or ternary system - base3)

base 8 (octal system - base8)

— base 9 (nonary system - base9)

— base 10 (decimal system - base10)

— base 12 (duodecimal system - base12), for month or hours

— base 16 (hexadecimal system - base16) in informatics for bytes

— base 20 (vigesimal system - base20) used by Mayan numeral system (and Aztecs)

base 26 (alphabetic system - base26)

— base 27 (alphabetic system + special character - base27)

base 36 (alphanumeric system - base36)

base 37 (alphabetic system + special character - base37)

— base 60 (sexagesimal system - base60) for minutes, seconds by Sumerians and Babylonians.

base 62 (full alphanumeric system - base62)

All the basics can be used for computer coding or any other math problem.

Example: Encoding and decoding base64 is common on the Internet.

Source code

dCode retains ownership of the "Base N Convert" source code. Any algorithm for the "Base N Convert" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Base N Convert" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Base N Convert" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "Base N Convert" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source. Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link: https://www.dcode.fr/base-n-convert
In a scientific article or book, the recommended bibliographic citation is: Base N Convert on dCode.fr [online website], retrieved on 2025-04-14, https://www.dcode.fr/base-n-convert

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Base N Convert' tool for free! Thank you!


https://www.dcode.fr/base-n-convert
© 2025 dCode — The ultimate collection of tools for games, math, and puzzles.
 
Feedback