Skip to content
GENERATORS

Random Color Generator – HEX, RGB & HSL

Generate a random colour in HEX, RGB and HSL.

  • Free
  • No signup
  • Runs in your browser

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

Random Color Generator

About Random Color Generator

Click Run Tool and the generator picks three random bytes for red, green and blue, then shows the colour as a HEX code, as an rgb() value and as an hsl() value. All three formats can be pasted straight into CSS.

Random colours are useful for design inspiration, placeholder avatars, chart series and testing how a layout behaves with different backgrounds. If you want to adjust a colour you like, copy its HEX value into the Color Picker and Converter.

How to use Random Color Generator

  1. Click Run Tool to get a new random colour.
  2. Copy the HEX, RGB or HSL value that suits your code.
  3. Repeat until you find a colour you like.

Common uses

  • Finding colour ideas for a banner, button or chart.
  • Generating background colours for avatars or placeholders.
  • Testing text contrast on unexpected backgrounds.

Privacy and safety

This tool runs in your browser. The text you enter is processed on your device and is not sent to NHP Learning.

Frequently asked questions

What is the difference between HEX, RGB and HSL?

They describe the same colour in different ways. HEX and RGB mix red, green and blue. HSL uses hue, saturation and lightness, which makes it easier to create lighter or darker variations.

Will the colour be accessible?

Random colours are not checked for contrast. Test text colour against its background, aiming for a ratio of at least 4.5:1 for normal text.

How do I convert a colour I already have?

Use the Color Picker and Converter, or the RGB to HEX and HEX to HSL converters.

Learn to build this yourself

Free tutorials and courses on NHP Learning cover PHP, JavaScript, SQL and WordPress, from the basics to real projects.