Colors
Random Hex Color Generator
Used by developers, writers, and creators worldwide.
A random hex color generator gives you an instant, valid #RRGGBB code you can drop straight into CSS, Figma, or Tailwind without stopping to think. No color theory required — just click and copy. The color mode filter is what makes it genuinely useful. Set it to Light for pastel-range backgrounds, Dark for low-brightness tones that suit dark themes, Vibrant for high-saturation accents, or Muted for soft secondary fills. Developers use it to seed placeholder avatar colors, test contrast logic, or verify a color picker is wired up. Designers use it to break creative blocks by introducing an unexpected hue into a layout they've been staring at too long.
Loading usage…
Free forever — no account required
How to use
- Choose your options above
- Click Generate
- Copy your result
Detailed instructions
- Select a Color Mode from the dropdown: choose Any, Light, Dark, Vibrant, or Muted based on your project's needs.
- Click the Generate button to instantly produce a random hex color code matching your chosen mode.
- Preview the color in the output swatch to judge it visually before committing.
- Click the copy icon or select the hex code text and copy it to your clipboard.
- Paste the hex code directly into your CSS file, design tool color input, or code editor wherever a color value is needed.
Use Cases
- •Seeding random background colors for user avatar placeholders in a React component
- •Stress-testing CSS contrast ratios with light and dark hex values in Storybook
- •Finding a muted hex for a card background that won't compete with foreground content
- •Grabbing a vibrant accent hex to prototype a data visualization color scale
- •Filling dummy color swatches in a Figma design system component library
Tips
- →Use 'Light' mode when you need placeholder background colors for cards — they'll be readable with dark text by default.
- →Generate 5–6 'Vibrant' colors in quick succession to build a rough data-visualization palette before refining in a palette tool.
- →Muted mode pairs well with a single manually chosen accent: use random muted codes for secondary elements, then set your brand color as the primary.
- →If a generated color is close but not quite right, note its hex value, open your design tool's color picker, and nudge the hue or lightness from there rather than generating again.
- →For accessible UI, always check generated hex codes against a contrast checker — even 'Light' or 'Dark' modes don't guarantee WCAG-compliant contrast ratios with a specific opposing color.
- →When seeding avatar backgrounds in code, store the hex value against the user ID so the color stays consistent across sessions rather than regenerating on each load.
FAQ
how do I use a random hex color in CSS or Tailwind
Paste it directly into any CSS color property — for example, background-color: #a3f2c1. In Tailwind, add it to your tailwind.config.js under the colors key to register it as a custom token. Both accept the standard six-digit #RRGGBB format this generator outputs.
what does the color mode filter actually do
It narrows the output pool based on brightness or saturation. Light returns high-brightness codes good for backgrounds; Dark returns low-brightness codes suited to text or dark themes. Vibrant gives high-saturation, intense hues, while Muted returns soft, desaturated tones. Any applies no filter and picks from all 16.7 million possible hex values.
is there a way to generate multiple random hex colors at once
This generator produces one color per click, which is intentional for quick single-color decisions. For a full palette, click several times and copy each code, or use a dedicated palette generator that outputs complementary or analogous sets together. For programmatic use, Math.floor(Math.random()*16777215).toString(16) gives unlimited hex values in JavaScript.