Sunrise and sunset widget for your website

Today in São Paulo: ☀️ 05:44 · 🌇 18:06 5,571 cities, free, no sign-up

Pick the state and the city, preview it live and copy a single line of code to show today's sunrise and sunset on your website, blog or online store, updated every day. It works for any of Brazil's 5,571 municipalities.

1. Set up the widget

2. Preview it

Live preview (this is the actual widget your site will load)

3. Copy the code

Please note: the widget includes a small "Brasília Time" link at the bottom, pointing to the sunrise and sunset page of the chosen city. It is a normal link, without nofollow, and it is what keeps the widget free: it must not be removed, hidden or covered. By using the code you agree to keep it visible.

What the widget shows

The widget is a compact box with the city name and today's date, the time of sunrise and sunset in large figures and, if you tick the options, the day length, the morning and evening golden hour (the soft, warm light that photographers and filmmakers look for) and the Moon phase. All times are shown in the city's own local time, so a visitor in Lisbon or Tokyo sees the same numbers as someone standing in the city.

The times are calculated on our server with the same astronomical method used on every sunrise and sunset page of the site, and the date is part of the page. When the day changes the widget asks the server for the new numbers by itself. If JavaScript is disabled, the box still shows the last calculated times.

Who it is for

How to add it to your website

  1. Choose the state and the city above, then theme, size and options. The preview and the code update at each change.
  2. Click "Copy code". It is a single <iframe> tag: nothing to install, and no script to load on your own page.
  3. Paste it where the box should appear: sidebar, footer, a page about the city or a blog post.

WordPress

In the block editor, add a Custom HTML block and paste the code. For a sidebar or footer, go to Appearance > Widgets and add a Custom HTML widget (on block themes, use Appearance > Editor). In the classic editor, switch to the Text tab before pasting; the visual tab may strip the tag.

Wix, Squarespace, Blogger, Google Sites and Shopify

Wix: Add Elements > Embed Code > Embed HTML. Squarespace: a Code block. Blogger: Layout > Add a Gadget > HTML/JavaScript. Google Sites: Insert > Embed > Embed code. Shopify: a Custom Liquid section. Some free plans restrict custom HTML, so check that yours accepts iframes.

Make it responsive

The content scales with the iframe, so let the iframe scale: wrap it in a container with a maximum width and use width:100%, keeping the height proportional (about 35% of the width, a little more with the extra lines).

Customize through the address

ParameterValuesWhat it does
uftwo letters, e.g. spState. Invalid values fall back to São Paulo.
cityslug, e.g. campinasCity, as in the address of its page. Invalid values fall back to São Paulo, SP.
themelight, dark, transparentColors of the box.
colorhex, e.g. ffffffText color for the transparent theme.
sizesm, md, lgScale of the text inside the iframe.
len, gold, moon1 or 0Show day length, golden hour and Moon phase.
langpt or enLanguage of the labels, of the date and of the credit link.

Attribution link and privacy

The link is part of the deal. The widget is free because it carries a small "Brasília Time" link to this site. It is an ordinary link, not marked nofollow, and it must stay visible: hiding it, making it transparent, shrinking it to an unreadable size or covering it with other elements is not allowed.

No cookies, no tracking. The widget page sets no cookies, shows no ads, loads no analytics and is not indexed by search engines. The only thing that happens is the usual request the visitor's browser makes to load the iframe.

Related tools

Frequently asked questions

Is the sunrise and sunset widget free?

Yes. There is no sign-up and no fee. The only condition is to keep the small "Brasília Time" link at the bottom of the widget visible; it points to the city page on this site.

Do the times change every day?

Yes. The times are calculated on our server for today's date in the city's time zone. If the page stays open across midnight, the widget fetches the new times by itself, with no reload.

Can I use a city that is not a state capital?

Yes. The generator covers all 5,571 Brazilian municipalities: pick the state, then the city. Each city uses its own coordinates and the correct time zone, including Acre, Amazonas, part of Pará and Fernando de Noronha.

Can I remove or hide the credit link?

No. The link is what pays for the free use, and it is a normal link without nofollow. Hiding, covering, making it transparent or shrinking it to an unreadable size is not allowed. If you do not want to show it, do not use the widget.

How accurate are the times?

The times are calculated astronomically for the municipality's urban center, accurate to about a minute, accounting for atmospheric refraction and the upper limb of the Sun. Mountains, buildings and local terrain can make what you see from a window earlier or later.

Does the widget use cookies or collect visitor data?

No. The widget page has no cookies, ads or analytics. It only receives the normal request to load the iframe, like any external image or font.