Home Text Tools Math & Numbers Developer Tools Date & Time Image Tools Blog
HTML Color Codes

How to Pick Colors for a New Website and Copy the HEX Code

Choose a main color, build a small palette around it, and paste the HEX codes into your CSS with the HTML Color Codes tool.

Starting a website often stalls on one question: what color should it be? Staring at a blank stylesheet does not help. It is easier to choose a color visually, see its code, and paste it straight into your CSS. The HTML Color Codes tool is built for exactly that workflow.

HTML Color Codes FREE online toolRuns in your browser. No sign-up, nothing to install. Open the tool

Start with one main color

Most good websites are built around a single brand color, used for buttons, links, and a few accents. Everything else is neutral: white or near-white backgrounds, dark gray text, and a lighter gray for borders. Pick the main color first and resist the urge to choose five at once.

Think about what the site is for. Blues and greens tend to feel calm and trustworthy, while saturated oranges and reds feel urgent. That is a tendency, not a rule, so judge by looking at the color on a real page rather than in a swatch.

Choose it and copy the HEX code

A HEX code is a six-digit value such as #1A73E8, written after a hash sign. The pairs of digits are the red, green, and blue amounts from 00 to FF. CSS accepts it anywhere a color is allowed.

  1. Open the HTML Color Codes tool and click around the picker until a color feels right, or type a code you already have.
  2. Check the HEX value shown for it and copy it.
  3. Paste it into your stylesheet as a custom property, for example --brand: #1A73E8; in :root.
  4. Use var(--brand) wherever the color appears, so a later change happens in one place.
  5. Reload the page and look at the color next to your real text and images.

Build the rest of the palette

One color is not a palette. You need a darker shade for hover states and headings, a very light tint for section backgrounds, and a neutral gray scale. The tool shows lighter and darker versions of any color, which saves you from guessing by eye.

It also lists matching colors. A complementary color sits opposite on the color wheel and works for a single call to action. Use it sparingly, because two loud colors compete for attention.

Check readability before you commit

The most common mistake is light text on a pale background. Body text should have strong contrast against its background; WCAG asks for a contrast ratio of at least 4.5 to 1 for normal-size text. White text on a medium blue often passes, while white text on a yellow or light green usually does not.

Test your choices with real paragraphs, not just a headline. A color that looks great on a large button can be tiring over a full page of small text.

Common pitfalls

  • Using a pure black text color on pure white everywhere. Very dark gray such as #222222 is easier on the eyes.
  • Picking colors on one screen and never checking another. Laptop and phone displays can render the same HEX code noticeably differently.
  • Mixing formats randomly. HEX, RGB, and HSL all work, but pick one for your stylesheet so it stays readable.
  • Forgetting link and visited colors, which default to browser blue and purple unless you set them.
  • Choosing a color for a logo and a color for the site separately, then finding they clash.

A short worked example

Say you are building a site for a small bakery. You pick a warm terracotta, copy its HEX code, and set it as --brand. You take a darker shade for hover, a pale tint for the footer background, and a charcoal gray for text. That is four colors, all copied from one tool, and the whole site already looks consistent.

Try the free HTML Color Codes
Runs in your browser. No sign-up, nothing to install.

Comments (0)

No comments yet. Be the first to share a thought.