Color Code Converters | HEX, RGB, HSL

Explore how channel values describe a color and check whether text is readable against its background.

Quick Answer

Color code conversion is the process of translating a color from one notation or color model into another.

Color samples beside a laptop used to compare digital palettes

Color Code Converters

Convert colors between HEX, RGB, RGBA, HSL, HSLA, HSV/HSB, HWB, CMYK, decimal integer, CIE XYZ, CIE Lab, and LCH. Check WCAG contrast, generate color palettes, create tints and shades, copy CSS-ready values, and export color tables.

HEX to RGB RGB to HSL HSV / HSB HWB CMYK Decimal color Lab / LCH WCAG contrast Palette generator CSS variables CSV export

1. Enter Color

Supports HEX, RGB/RGBA, HSL/HSLA, and a practical set of common CSS color names.

Contrast Checker

Options

2. Converted Result

Preview
Primary HEX value #40A951

This color is converted into web, design, print-style, and accessibility-friendly formats.

RGB rgb(64, 169, 81)
HSL hsl(130, 45%, 46%)
Contrast 3.13:1
WCAG Large AA
Color Conversion Flow Input HEX / RGB / HSL sRGB R, G, B channels Outputs CSS + contrast #40A951 → RGB/HSL/CMYK/Lab Contrast and palette update automatically.

3. All Color Code Outputs

Format Converted Value Best Use

Contrast and Accessibility

Accessibility Metric Value Interpretation

Color Harmony and Palette

Channel Summary

CSS Variable Output

\[ \text{HEX} = \#RRGGBB,\quad R,G,B\in[0,255] \]

Color Conversion Formulas

A color converter starts with a standard internal representation. For web colors, the practical base format is often sRGB with red, green, blue, and optional alpha channels. Each RGB channel normally ranges from 0 to 255.

\[ R,G,B\in[0,255] \] \[ r=\frac{R}{255},\quad g=\frac{G}{255},\quad b=\frac{B}{255} \]

HEX color is simply RGB written in base 16:

\[ \#RRGGBB \] \[ RR=\operatorname{hex}(R),\quad GG=\operatorname{hex}(G),\quad BB=\operatorname{hex}(B) \]

HSL uses hue, saturation, and lightness. First define:

\[ C_{\max}=\max(r,g,b) \] \[ C_{\min}=\min(r,g,b) \] \[ \Delta=C_{\max}-C_{\min} \] \[ L=\frac{C_{\max}+C_{\min}}{2} \]

Hue depends on the largest channel:

\[ H= \begin{cases} 0,&\Delta=0\\ 60\left(\frac{g-b}{\Delta}\bmod 6\right),&C_{\max}=r\\ 60\left(\frac{b-r}{\Delta}+2\right),&C_{\max}=g\\ 60\left(\frac{r-g}{\Delta}+4\right),&C_{\max}=b \end{cases} \] \[ S= \begin{cases} 0,&\Delta=0\\ \frac{\Delta}{1-|2L-1|},&\Delta\ne0 \end{cases} \]

HSV, also called HSB, uses value instead of lightness:

\[ V=C_{\max} \] \[ S_{HSV}= \begin{cases} 0,&C_{\max}=0\\ \frac{\Delta}{C_{\max}},&C_{\max}\ne0 \end{cases} \]

CMYK is a print-style model. A simple RGB-to-CMYK conversion is:

\[ K=1-\max(r,g,b) \] \[ C=\frac{1-r-K}{1-K},\quad M=\frac{1-g-K}{1-K},\quad Y=\frac{1-b-K}{1-K} \]

WCAG contrast uses relative luminance. For each normalized sRGB channel \(c\):

\[ c_{\text{linear}}= \begin{cases} \frac{c}{12.92},&c\le0.04045\\ \left(\frac{c+0.055}{1.055}\right)^{2.4},&c>0.04045 \end{cases} \] \[ L=0.2126R_{\text{linear}}+0.7152G_{\text{linear}}+0.0722B_{\text{linear}} \] \[ \text{Contrast Ratio}=\frac{L_1+0.05}{L_2+0.05} \]

Complete Guide to Color Code Conversion

Color code conversion is the process of translating a color from one notation or color model into another. Web designers, developers, brand designers, teachers, students, marketers, UI/UX designers, accessibility reviewers, and content creators often need the same color in different formats. A designer might receive a HEX code from a brand guide, but the CSS animation needs HSL. A print vendor may ask for CMYK-style values. A developer may need RGBA for transparency. An accessibility reviewer may need relative luminance and contrast ratio. This tool brings those conversions into one workflow.

The most common web color format is HEX. A HEX color such as #40A951 represents red, green, and blue channel values in hexadecimal notation. The first two digits are red, the next two are green, and the last two are blue. Because hexadecimal is base 16, each two-character pair can represent values from 00 to FF, which corresponds to 0 through 255 in decimal. This gives each RGB channel 256 possible values.

RGB notation is more direct for many beginners. A color such as rgb(64, 169, 81) means red is 64, green is 169, and blue is 81. In additive color mixing, red, green, and blue light combine to create the colors displayed on screens. When all three channels are 0, the result is black. When all three are 255, the result is white. Equal channel values produce grays.

RGBA adds an alpha channel. Alpha describes opacity. An alpha value of 1 is fully opaque, while 0 is fully transparent. A value like 0.5 is semi-transparent. In CSS, alpha can be written in several ways, such as rgba(64, 169, 81, 0.5) or modern slash notation like rgb(64 169 81 / 0.5). Alpha affects how the color looks when it is composited over a background.

HSL stands for hue, saturation, and lightness. It is often easier for humans to adjust than RGB. Hue is the angle around the color wheel. Red is near 0 degrees, green is near 120 degrees, and blue is near 240 degrees. Saturation controls how colorful or gray the color is. Lightness controls how dark or light it is. Designers often use HSL to create tints, shades, and related color variations.

HSV, also called HSB, stands for hue, saturation, and value or brightness. It is common in design tools and color pickers. HSV is useful when thinking in terms of brightness. HSL and HSV use the same hue idea but define saturation and brightness/lightness differently. This is why the same RGB color can have different saturation numbers in HSL and HSV.

HWB stands for hue, whiteness, and blackness. It is another cylindrical color model that can be intuitive for adjusting how much white or black is mixed into a hue. Although HWB is less common than RGB and HSL in everyday CSS workflows, it is part of modern CSS color thinking and can be useful for design-system exploration.

CMYK stands for cyan, magenta, yellow, and key black. It is commonly associated with print workflows. RGB is an additive screen model, while CMYK is a subtractive print-style model. The conversion from RGB to CMYK in this tool is a mathematical approximation, not a replacement for professional color-managed print workflows. Real print output depends on paper, ink, press settings, color profiles, and calibration.

Decimal color is a single integer representation of RGB. A color can be stored as \(R\times65536+G\times256+B\). For example, RGB channels can be packed into a 24-bit integer. This is useful in programming, databases, older graphics systems, and some APIs. The decimal representation is compact but less readable than HEX for most design work.

CIE XYZ, Lab, and LCH are color-science formats. XYZ is a foundational color space based on human color matching. Lab is designed to be more perceptually organized than raw RGB, with lightness and opponent-color axes. LCH is a cylindrical form of Lab that uses lightness, chroma, and hue. These formats are useful for deeper color analysis, perceptual color differences, and modern design discussions.

Modern CSS has been expanding beyond classic HEX, RGB, and HSL. CSS Color Module Level 4 describes additional color functions and spaces, including lab(), lch(), and hwb(). Current browser support varies by feature and version, so production sites should test the formats they use. HEX and RGB remain the safest broadly compatible choices. HSL is also widely supported and practical for design systems.

Contrast checking is one of the most important practical features in a color converter. A color may look attractive but fail accessibility when used as text over a background. WCAG contrast ratio compares the relative luminance of the foreground and background. Higher ratios mean stronger contrast. For normal text, a ratio of 4.5:1 is the common AA target. For large text, 3:1 is the common AA target. AAA targets are higher.

Relative luminance is not a simple average of red, green, and blue. Human vision is more sensitive to green than to red or blue, so the luminance formula weights green heavily. The sRGB channels also need to be linearized before weighting. This is why the WCAG formula looks more complex than a simple brightness average.

Palette generation helps designers build related colors. A complementary color is roughly 180 degrees away on the hue circle. Triadic colors are roughly 120 degrees apart. Analogous colors sit near the original hue. Tints move a color toward white. Shades move it toward black. These relationships are mathematical starting points; a polished palette may still need manual adjustment for contrast, branding, emotion, and visual balance.

Color harmony is not the same as accessibility. A palette can be harmonious but still fail text contrast. A brand color can be beautiful but not suitable for small text on white. Use color harmony for visual direction and contrast checks for readability. For user interfaces, always check text, buttons, links, alerts, charts, and focus states against their backgrounds.

When designing a website, it is helpful to store colors as CSS variables. A variable such as --brand-green: #40A951; can be reused throughout a stylesheet. This makes theme changes easier. It also helps keep a design consistent. This converter creates CSS variable output so users can copy a small design-token block into their stylesheet.

HEX shorthand is another useful detail. A color like #33AAFF can be shortened to #3AF because each pair repeats the same character. But #40A951 cannot be shortened because the pairs do not repeat. Shorthand is compact, but full six-digit HEX is usually clearer for brand systems and documentation.

Alpha HEX uses eight digits, written as #RRGGBBAA. The last two digits represent alpha. For example, alpha 255 is fully opaque, alpha 128 is roughly 50% opacity, and alpha 0 is fully transparent. Some environments support eight-digit HEX; older tools may not. RGBA notation is often clearer when transparency is important.

A color converter can also help debug design inconsistencies. Sometimes a brand guide uses HEX, a Figma file displays RGB, a CSS file uses HSL, and a developer tool displays computed colors in a different syntax. Converting them into a common base reveals whether they are actually the same color or slightly different. Even a one-channel difference can matter in strict branding work.

For education, color conversion is a strong applied-math topic. It uses base conversion, ratios, percentages, cylindrical coordinates, interpolation, luminance weighting, gamma correction, and accessibility thresholds. Students can learn how a screen color becomes numbers and how those numbers can be transformed across models.

This page is not an official exam score calculator. There is no universal score guideline, score table, or next exam timetable for color conversion. It can support computer science, design, accessibility, digital art, web development, and applied mathematics, but official exam schedules and scoring rules must come from the relevant school, course provider, or exam board.

Accuracy note: RGB, HSL, HSV, HWB, and simple CMYK conversions are mathematical conversions. Professional print, photography, cinema, and brand-production workflows may require calibrated monitors, ICC profiles, print proofs, and color-managed software.

Reference Links

Useful references: W3C CSS Color Module Level 4, W3C CSS Color Module Level 5, WCAG 2.2, MDN CSS color values, and MDN HEX color.

How to Use Color Code Converters

  1. Choose an input mode. Use flexible input, RGB fields, HSL fields, HSV fields, CMYK fields, or decimal integer.
  2. Enter your color. Type a HEX code, RGB value, HSL value, named color, or use the color picker.
  3. Click Convert Color. The tool converts the color into web, design, print-style, and accessibility formats.
  4. Check contrast. Enter foreground and background colors to see WCAG contrast ratio and pass/fail guidance.
  5. Review palette swatches. Use complementary, triadic, analogous, tint, and shade colors as starting points.
  6. Copy or export. Copy HEX, copy all outputs, download CSV, or print/save the color report.
Format Example Best Use
HEX #40A951 Brand guides, CSS, design handoff, quick web use.
RGB / RGBA rgb(64, 169, 81) CSS, JavaScript, canvas, transparency with alpha.
HSL / HSLA hsl(130, 45%, 46%) Adjusting hue, saturation, and lightness in design systems.
HSV / HSB hsv(130, 62%, 66%) Design tools and brightness-based color picking.
CMYK cmyk(62%, 0%, 52%, 34%) Approximate print-style conversion; not a full print color-management workflow.
Lab / LCH lab(...), lch(...) Color science, perceptual analysis, advanced color discussions.

Score, Course, and Exam Table Note

Requested Item Status for This Color Tool Correct Guidance
Score guidelines Not applicable This is a color conversion and accessibility utility, not an official score calculator.
Score table Not applicable There is no universal academic score table for color-code conversion.
Next exam timetable Not applicable Use official school or exam-board sources for course-specific exam dates.
Course relevance Useful for design, web development, and applied math Supports base conversion, ratios, percentages, accessibility, UI design, and color theory.

Color Code Converter FAQ

What is a color code converter?

A color code converter translates one color notation into another, such as HEX to RGB, RGB to HSL, HSL to HSV, RGB to CMYK, or RGB to Lab.

What is the difference between HEX and RGB?

HEX and RGB represent the same red, green, and blue channels. HEX writes the channels in base 16, while RGB writes them as decimal values from 0 to 255.

What is HSL used for?

HSL is useful for adjusting hue, saturation, and lightness. Designers often use it to create tints, shades, and related color variations.

Is CMYK conversion exact?

The calculator gives a simple mathematical CMYK approximation. Professional print color requires color profiles, calibrated devices, and proofing.

How is contrast ratio calculated?

Contrast ratio uses relative luminance: \(\text{ratio}=(L_1+0.05)/(L_2+0.05)\), where \(L_1\) is the lighter color and \(L_2\) is the darker color.

What contrast ratio should I aim for?

A common WCAG AA target is 4.5:1 for normal text and 3:1 for large text. AAA targets are 7:1 for normal text and 4.5:1 for large text.

Can I use this for CSS variables?

Yes. The tool creates copy-ready CSS variables with HEX, RGB, HSL, and contrast-friendly values.

Advertisement

Decode a hexadecimal color by hand

Split #3380CC into three pairs. The first pair represents three sixteens plus three ones, giving 51. The second gives 128 and the last gives 204. Enter those three decimal values in RGB order and compare the swatch. Removing the leading zeros from a pair would shift the position of the next channel, so always keep two digits per channel when writing a six-digit code.

Conversion of Another Base into Base 10 and Other Bases

We saw in Hindu-Arabic Positional System that our Hindu-Arabic system uses base 10, which is a system using place values of digits that depend on powers of 10 (or, are based on powers of 10). We’ve already worked with bases other than base 10: The Babylonian system was base 60, while the Mayan system was base 20.
To explore how our base 10 system is used, answer the following question: What’s the following quantity: 4,572? You probably said four thousand five hundred seventy-two (no, there is no “and” between hundred and seventy). But why do you think that 4 means four thousand? A very young person when learning their numbers might say that’s a four five seven and two. But you added the context of thousands to the four. Why?
Place value, that’s why. You learned early on that where the numeral was gave it different meanings. Ten thousands, thousands, hundreds, tens, and ones. So, you translate that symbol string (4,572) into “four thousand five hundred seventy-two.” As we saw in Hindu-Arabic Positional System, expanding a Hindu-Arabic number involved writing the number using each digit times its appropriate power of 10. So, we could write 4,572 as 4×103+5×102+7×101+2×100=4×1000+5×100+7×10+2×1.
One possible reason we use base 10 is that we have 10 fingers, and in the cultures where the Hindu-Arabic system developed, that became the standard. Other cultures may have used other ways of organizing numbers, perhaps using 20 by including toes, or using 60 because 60 has many divisors. Mathematically though, base 10 is an awkward base to work in since 10 has limited divisors. But we think it is easy and simple because that’s what we’ve been taught to use.
Using a base 10 system means we need 10 symbols to make our numbering system work: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Now imagine that we all only had 6 fingers instead of 10 and our counting system was based on those 6 fingers. We would be counting in groups of 6, not groups of 10. How would this change how we work with quantity?
First, we’d need only six symbols. Let’s use 0, 1, 2, 3, 4, 5. Second, our place values would be based on powers of 6, not powers of 10. For instance, the number 3,024 in base 6 would be 3×63+0×62+2×61+4×60. That is how you can translate a base 6 number into a base 10 number. When we calculate that expression we get 3×63+0×62+2×61+4×60=3×216+0×36+2×6+4×1=648+0+12+4=664.
This means the base 6 number 3,024 is equal to the base 10 number 664.
From now on, if we are using a base 6 number, we will follow it with the subscript 6, like the following: 3,0246 means the number is in base 6.
A base 10 number gets no subscript (it’s the standard). So, 3,024 is a base 10 number. A base 13 number would be 4,67213.
So, a base 6 system uses only the symbols 0, 1, 2, 3, 4, and 5. Also, the place values use powers of 6. However, we still don’t know how to count in base 6. In order to do so, we’d have to know how to represent the quantities larger than five in base 6. Let’s review how our base 10 system works by counting from 0 to 100, which shows how larger values are represented.
In writing the base 10 numbers, you start with these first 10 values:
0 1 2 3 4 5 6 7 8 9
But you’ve run out of symbols. So, we use two digits:
10 11 12 13 14 15 16 17 18 19
The 1 out front means you’ve run out of digits one time.
But now you’ve run out twice. Continuing with those numbers gives:
20 21 22 23 24 25 26 27 28 29
And so on,
30 31 32 33 34 etc.…
Eventually, you hit the 90s,
90 91 92 93 94 95 96 97 98 99
And you’ve run out of the digits again! So, we say we’ve run out of digits in the tens place one time, hence:
100 101 102 103 104 105 106 107 108 109
That’s the pattern we use in base 10. We write out the symbols until we’ve used all the symbols, then add a digit in front that counts how many times we’ve used the digits. Knowing the numbers, or being able to count higher and higher, is necessary to understand how all the arithmetic works, as it all goes back to counting.
The counting pattern is the same for any other base, including base 6. So, let’s start:
0 1 2 3 4 5
But we’ve run out of symbols! Just like in base 10, we use a second digit, where the first digit will tell us we’ve run out of symbols one time.
10 11 12 13 14 15
And we use the same pattern:
20 21 22 23 24 25
30 31 32 33 34 35
40 41 42 43 44 45
50 51 52 53 54 55
But we’ve run out of symbols for that front digit. So, we indicate it the same way as in base 10…by adding a third digit in front, indicating we’ve run out of symbols once in the second place:
100 101 102 103 104 105
110 111 etc.
The symbol pattern is the same, but truncated. We only use the six symbols. So that is how we represent base 6. Being able to write out these numbers is important when working with addition in the base.
When using a base larger than 10, though, we need more symbols. Instead of creating new symbols, we use capital letters, with A representing the digit for "10," B representing the digit for "11," and so on.

Determining Digits of a Base with Less Than 10 Digits

What are the digits used for base 7?
Solution
Since this is base 7, we need only 7 symbols: 0, 1, 2, 3, 4, 5, 6.

Determining Digits of a Base with More Than 10 Digits

What are the digits used for base 14?
Solution
Since this is base 14, we need 14 symbols. We don’t have single character numbers for 10, 11, 12, and 13, so, in a fit of inspired creativity, we use capital letters A, B, C, D to represent those quantities. So, the digits in base 14 are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D.

Converting from One Base into Another

Convert 3,6017 into base 10.
Solution
In base 7, the place values are powers of 7. Since there are four digits, the highest power of 7 that is used is 3. This yields 3,6017=3×73+6×72+0×71+1×70=3×343+6×49+0×7+1=1,029+294+0+1=1,324.

Converting from Base 14 to Base 10

Convert 4B714 into base 10.
Solution
In base 14, the place values are powers of 14. Since there are three digits, the highest power of 14 is 2. Also recall that in base 14, 10 is represented by A, 11 is represented by B, 12 is represented by C, and 13 is represented by D. Using that, we convert to base 10:
4B714=4×142+B×141+7×140=4×196+11×14+7×1=784+154+7=945.

Converting from Base 12 to Base 10

Convert A1612 into base 10.
Solution
In base 12, the place values are powers of 12. Since there are three digits, the highest power of 12 is 2. Also recall that in base 12, 10 is represented by A and 11 is represented by B. Using that, we convert to base 10:
A1614=10×122+1×121+6×120=10×144+1×12+6×1=1,440+12+6=1,458.

Converting from Base 2 to Base 10

Convert 10112 into base 10.
Solution
In base 2, the place values are powers of 2. Since there are four digits, the highest power of 2 is 3. Using that, we convert to base 10:
10112=1×23+0×22+1×21+1×20=1×8+0×4+1×2+1×1=8+0+2+1=11.

Writing Numbers in Base Systems Other Than Base 10

Write the numbers in base 7 up to 1007.
Solution
Step 1: Using the patterns we indicated earlier, we begin with the first seven digits.
0, 1, 2, 3, 4, 5, 6
Step 2: Since we’ve run out of digits, we start with 10, indicating we’ve run out of symbols once.
10, 11, 12, 13, 14, 15, 16
Step 3: Continuing in the same way, we get:
20, 21, 22, 23, 24, 25, 26
30, 31, 32, 33, 34, 35, 36
40, 41, 42, 43, 44, 45, 46
50, 51, 52, 53, 54, 55, 56
60, 61, 62, 63, 64, 65, 66
Now, all the digits have been used in the leading digits. Since the digits have all been used in that leading digit, we use 100, as in base 10.
100

Writing Numbers in Bases with More Than 10 Symbols

Write the numbers in base 14 up to 10014.
Solution
Step 1: Using the patterns we indicated earlier, we begin with the first 14 digits.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D
Step 2: Since we’ve run out of digits, we start with 10, indicating we’ve run out of symbols once.
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D
Step 3: Continuing in the same way, we get:
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2A, 2B, 2C, 2D
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3A, 3B, 3C, 3D
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 4A, 4B, 4C, 4D
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 5A, 5B, 5C, 5D
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 6A, 6B, 6C, 6D
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 7A, 7B, 7C, 7D
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8A, 8B, 8C, 8D
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 9A, 9B, 9C, 9D
A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, AA, AB, AC, AD
B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, BA, BB, BC, BD
C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, CA, CB, CC, CD
D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, DA, DB, DC, DD
100
Base 2 is important in the digital age, as it is the system used by computers. It is the simplest base to work with, but has the drawback that the numbers in base 2 may use many, many digits. In Addition and Subtraction in Base Systems and Multiplication and Division in Base Systems, we will look at base 2 in each situation.

Writing Numbers in Base 2

Write the numbers in base 2 up to 1002.
Solution
Base 2 uses only two symbols: 0 and 1. Following the pattern established previously, the numbers in base 2 up to 1002 are 0, 1, 10, 11, and 100.

Conversion of Base 10 into Another Base

Converting from base 10 into another base uses repeated division, recording the remainder at each step. Then, the number in the new base is the remainder starting from the last remainder found. To be accurate in what we’re saying, we need to remind ourselves of some terminology associated with division. When integers are divided, the one being divided is the dividend, and the one that is dividing the dividend is the divisor. The quotient is the largest natural number that can be multiplied by the divisor where the product is less than the dividend.
When the integer n is divided by the integer d, n is called the dividend and d is the divisor.
To convert a base 10 number n into base d, we divide n by d, recording the remainder. Then we divide the quotient from that step by the base d, and record the remainder again. We continue this process until the quotient is 0. Then, the base d number has digits that start with the last remainder and use each remainder in reverse order.

Converting from Base 10 into a Lower Base

Convert 298 to base 6.
Solution
We divide 298 by 6, and record the remainder. Then we divide the quotient from that step by 6, and record the remainder again. We continue this process until the quotient is 0. Then, the base 6 number has digits that start with the last remainder and use each remainder in reverse order.
Step 1: When we divide 298 by 6, we get 49r46298. The quotient is 49 and the remainder is 4.
Step 2: Now we divide the quotient, 49, by 6. This gives 8r1649. The quotient is 8 and the remainder is 1.
Step 3: Repeating, we get 1r268. The quotient is 1 and the remainder is 2.
Step 4: Finally, we perform the operation on the quotient 1, 0r161 giving us a quotient of 0 and a remainder of 1.
Step 5: The base 6 number has digits equal to the remainders in reverse order, 12146. So, 298 in base 10 when converted to base 6 is 12146.

Converting from Base 10 into a Higher Base

Convert 45,134 to base 13.
Solution
We divide 45,134 by 13, and record the remainder. Then we divide the quotient from that step by 13, and record the remainder again. We continue this process until the quotient is 0. Then, the base 13 number has digits that start with the last remainder and use each remainder in reverse order. It is at this step that we’ll convert to the base 13 digits, which are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C.
Step 1: When we divide 45,134 by 13, we get 3,471r111345,134 . The quotient is 3,471 and the remainder is 11.
Step 2: Now we divide the quotient, 3,471, by 13. This gives 267r0133,471. The quotient is 267 and the remainder is 0.
Step 3: Repeating, we get 20r713267. The quotient is 20 and the remainder is 7.
Step 4: Again, and we get 1r71320. The quotient is 1 and the remainder is 7.
Step 5: Finally, we get 0r1131, with quotient 0 and a remainder 1.
Step 6: The base 13 number has digits equal to the remainders in reverse order, which were 1, 7, 7, 0, and 11. The 11 is written as B in base 13. So, 45,134 in base 10 when converted to base 13 is 1770B13.

Converting from Base 10 into Base 2

Convert 100 to base 2.
Solution
Following the pattern above:
Step 1: We divide 100 by 2, and record the remainder.
Step 2: Then we divide the quotient from that step by 2, and record the remainder again.
Step 3: We continue this process until the quotient is 0.
Step 4: Following this process, the remainders are, in order, 0, 0, 1, 0, 0, 1, 1. Writing those in reverse order gives the number in base 2, 11001002.
Notice that 100 in base 2 took seven digits.